| Point | CHAR(n) | VARCHAR(n) |
|---|
| Length | Fixed. Always n characters, padded | Variable, up to n characters |
| Space | Always n | Only the text length (plus 1 or 2 bytes) |
| Best for | Values of the same length: country code, PIN | Names, emails, titles |
country_code CHAR(2), -- IN, US, UK
name VARCHAR(100) -- any name up to 100 characters
Use VARCHAR for most text. See MySQL Data Types.
Learn more about the similar topics:
| Tutorials |
| No Content Found. |
| Exercises & Assignments |
| No Content Found. |
| Interview Questions & Answers |
| No Content Found. |