Type |
Size |
Describe |
Char[length] |
Length byte |
Fixed-length field, 0-255 bytes long |
Varchar[length] |
String length + 1 bytes |
The variable length field, before mysql5.03, has a length of 0-255 bytes, and after 5.0.3, the maximum length is 65535 bytes. A utf8 character occupies 3 bytes, and a gbk character occupies two bytes. 5.0 length is the number of characters, and 5.0 is the number of bytes before length. Why limit 64k is primarily a row size limit, then rows greater than 64k are in row overflow mode http://www.itpub.net/forum.php?mod=viewthread&tid=1600640 |
Tinytext |
String length + 1 bytes |
A string of 0-255 bytes in length |
Text |
String length + 2 bytes |
string with a maximum length of 0-65535 bytes |
Mediumtext |
String length + 3 bytes |
String, group whine length is 16,777,215 bytes |
Longtext |
String length + 4 bytes |
string with a maximum length of 4,194,967,295 bytes |
Tinyint[length] |
1 bytes |
Length is the display of lengths, when complement is played; Range: -128~127 or 0~255 |
Smallint[length] |
2 bytes |
Length is the display of lengths, when the complement is played; see http://blog.csdn.net/libo222/article/details/51508379 |
Mediumint[length] |
3 bytes |
Length is the display of lengths, when the complement plays a role; |
Int[length] |
4 bytes |
Length is the display of lengths, when the complement plays a role; |
Bigint[length] |
8 bytes |
Length is the display of lengths, when the complement plays a role; |
Float |
4 bytes |
Length is the display of lengths, when the complement plays a role; |
Double[length,decimals] |
8 bytes |
Length is the display of lengths, when the completion of the function; run a fixed decimal point |
Decimal[length,decimals] |
length+1 bytes or length+2 bytes |
Length is the display of lengths, when the complement plays a role; |
Date |
3 bytes |
Use YYYY-MM-DD format |
Datetime |
8 bytes |
Using YYYY-MM-DD HH:mm:SS format |
Timestamp |
4 bytes |
Use YYYYMMDDHHMMSS format |
Time |
3 bytes |
Use HH:MM:SS format |
Enum |
1 or 2 bytes |
Enum type |
Set |
1, 2, 3, 4, or 8 bytes |
As with enum, except that each column can have multiple possible values |
Blob |
|
is a variant of text. Allows the storage of binary files and can also be used for some encrypted data. |