Syntax\n------\n\n[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]\n\nDescription\n-----------\n\nA fixed-length string that is always right-padded with spaces to the specified length when stored. M represents the column length in characters. The range of M is 0 to 255. If M is omitted, the length is 1.\n\nTrailing spaces are removed when CHAR values are retrieved unless the PAD_CHAR_TO_FULL_LENGTH SQL mode is enabled.\n\nIf a unique index consists of a column where trailing pad characters are stripped or ignored, inserts into that column where values differ only by the number of trailing pad characters will result in a duplicate-key error.\n\nCHAR(0) columns can contain 2 values: an empty string or NULL. Such columns cannot be part of an index. The CONNECT storage engine does not support CHAR(0).\n\nUse Cases for Zero Length\n\nA CHAR(0) or VARCHAR(0) column occupies minimal space and is restricted to two possible values: an empty string ('') or NULL. You can use these columns for the following purposes:\n\n Legacy Compatibility: Include these columns to maintain compatibility with older applications that require a specific table schema, even if the data is no longer collected.\n Two-State Flags: A CHAR(0) NULL column can function as a boolean indicator. It uses only one bit of storage to distinguish between a "set" state (the empty string) and an "unset" state (NULL).\n* Row Marking: You can use a CHAR(0) column to mark a specific row in a table. For example, if you require only one "active" row, set that row to an empty string while keeping all other rows NULL.\n\nThe following error occurs if you attempt to insert any character data into a 0-length column: ERROR 1406 (22001): Data too long for column.\n\nExamples\n--------\n\nCREATE TABLE strtest (c CHAR(10));\nINSERT INTO strtest VALUES('Maria   ');\n\nSELECT c='Maria',c='Maria   ' FROM strtest;\n+-----------+--------------+\n| c='Maria' | c='Maria   ' |\n+-----------+--------------+\n|         1 |            1 |\n+-----------+--------------+\n\nSELECT c LIKE 'Maria',c LIKE 'Maria   ' FROM strtest;\n+----------------+-------------------+\n| c LIKE 'Maria' | c LIKE 'Maria   ' |\n+----------------+-------------------+\n|              1 |                 0 |\n+----------------+-------------------+\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/char