In MySQL database system, char and varchar are very common, and they are two very similar, are used to save relatively short string, such as saving the article title, message, email, user name and so on. The main difference between the two is the storage method:
The Char column length is the length that is declared when the table is created and is fixed, and the length is limited to between 0 and 255. Generally in the database design, the user to save passwords, names, IP information, because the basic length are fixed, with this type is more appropriate.
The value in the varchar column is a variable-length string, and the length is 0-255, extending to 65535 after 5.0.3.
When the query displays the data, char deletes the space at the end of the string (just the tail), while varchar retains the spaces completely. This way we do not need to trim the trailing spaces when we display the char type string.
Brother even education for you to solve more it technology problems.
Types of char and varchar for MySQL data types