CHAR
Fixed-length character string type. CHAR columns store strings of a specified length (0 to 255), padding with spaces if necessary.
Syntax
[NATIONAL] CHAR[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]Description
Examples
CREATE TABLE strtest (c CHAR(10));
INSERT INTO strtest VALUES('Maria ');
SELECT c='Maria',c='Maria ' FROM strtest;
+-----------+--------------+
| c='Maria' | c='Maria ' |
+-----------+--------------+
| 1 | 1 |
+-----------+--------------+
SELECT c LIKE 'Maria',c LIKE 'Maria ' FROM strtest;
+----------------+-------------------+
| c LIKE 'Maria' | c LIKE 'Maria ' |
+----------------+-------------------+
| 1 | 0 |
+----------------+-------------------+Data Too Long
NO PAD Collations
See Also
Last updated
Was this helpful?

