String type a) char and varchar
1. You need to specify the length of the character, the length of the char is the length of the character, and the length of the varchar is the length of the byte
2. The length specified in char is the actual length occupied, and the length specified by varchar is only a range, so varchar also takes 1-2 bytes to store the string exactly how many bytes it has. And the character that can be actually stored in varchar is related to encoding (UTF8 encoding 20,000, GBK encoding more than 30,000)
3.varchar more flexible storage footprint, but char is more efficient
4. If the length of the string is fixed known, use char, if the length of the string is variable, use varchar
b) Text:
Text type, which is similar to varchar, except that there is no need to specify a length, where longtext that there is no limit to the text.
c) Enum:
Enumeration type, similar to radio! The actual storage is the location of the original option, the location is replaced by 1,2,3,4, in theory can represent up to 65,535 options
D) Set:
collection type, similar to multi-select! The actual storage is also the location of the original selection, the location is replaced with 1,2,4,8, and then the location of all the options are added, theoretically can represent up to 64 multi-option
e) binary, varbinary, blob:
Binary text type, which is the char, varchar, and text of the byte stream, rarely used in actual projects
Learning notes: MySQL String type