What's the difference between CHAR and VARCHAR?
The most important difference is that CHAR is padded with spaces and VARCHAR is not. For example, if you have:
CREATE TABLE t1 (
INSERT INTO t1 (c1,c2) VALUES ('a', 'a');
The column c1 will contain value 'a', while column c2 will contain value 'a ' with additional space. Trailing spaces are ignored when doing comparisons, so both columns would match the
WHERE c = 'a'
clause of some query. Trailing spaces are respected by LIKE operator, which is a source of confusion for beginners (example in FAQ #309).