You can view the MySQL Help documentation in detail for these three types of instructions.
A summary of Char:
The maximum length of char is 255 characters, note that the character number and character set do not matter. There can be default values, and trailing spaces are truncated.
Summary of varchar:
The maximum length of varchar 65535 refers to the number of bytes that can be stored, in fact, up to 65,532 bytes, and 3 bytes for storage length. Note that the number of bytes is related to the character set . A kanji character occupies 3 bytes with UTF8 and 2 bytes in GBK. There can be default values, and trailing spaces are not truncated.
Summary of text:
Text and varchar are basically the same. Text ignores the specified size this differs from varchar, where text cannot have a default value. The trailing spaces are not truncated. Text uses an extra 2 bytes to store the size of the data, and varchar chooses a few bytes to store the size of the data. The 65535 bytes of text are all used to store data, and varchar consumes 1-3 bytes to store the data size.
Everything mentioned above is for MySQL only, and the other databases may be different. Please point out where there is something wrong.
------------------------------------------------------------------
1. varchar to a certain length will automatically convert to text
2. Can be done with varchar, absolutely no text, otherwise performance is much worse
3. For the article content and so on a kind of thing, have no choice, can only use text, for this suggestion must disassemble the storage ...
Summary of char,varchar,text differences in MySQL