First, the number type
Type |
Range |
Description |
|
Char (N) [binary] |
n=1~255 characters Binary: Distinguish case |
Fixed length |
Std_name Cahr (+) NOT NULL |
VarChar (N) [binary] |
n=1~255 characters Binary: Distinguish case |
Variable length |
std_address varchar (256) |
Tinyblob |
Maximum length 255 characters (2^8-1) |
Blob (binary Large objects) stores binary data and is case-sensitive |
Memo text NOT NULL |
Tinytext |
Maximum length 255 characters (2^8-1) |
Blob |
Maximum length 65,535 characters (2^16-1) |
Text |
Maximum length 65,535 characters (2^16-1) |
Mediumblob |
Maximum length 16,777,215 characters (2^24-1) |
Mediumtext |
Maximum length 16,777,215 characters (2^24-1 |
Longblob |
Maximum length 4,294,967,295 characters (2^32-1) |
Longtext |
Maximum length 4,294,967,295 characters (2^32-1) |
Enum |
The maximum number of collections is 65535 |
Enumeration (enumeration), enum radio, set check |
Sex enum (1,0) Habby set (' Play video games ', ' Sleep ', ' watch movies ', ' Listen to music ') |
Set |
The maximum number of collections is 64 |
Distinguish between null and not null:null to allow null values to be stored (NULL)
Second, the value
Type |
Range |
Description |
For example |
TINYINT[M] [UNSIGNED] |
-128~127 unsigned:0~255 |
|
Num tinyint unsigned |
SMALLINT[M] [UNSIGNED] |
-32768~32767 unsigned:0~ 65535 |
|
|
MEDIUMINT[M] [UNSIGNED] |
-8388608~8388607 unsigned:0~16777215 |
|
|
INT[M] [UNSIGNED] |
-2^31~2^31-1 Unsigned:0~2^32 |
|
|
BIGINT[M] [UNSIGNED] |
-2^63~2^63-1 Unsigned:0~2^64 |
|
|
Float [(M,D)] |
-3.4e+38~3.4e+38 (approx) |
Note: M is length, D is decimal, Float 4 bytes,double 8 bytes |
|
Double [(M,D)] |
-1.79e+308~1.79e+308 (approx) |
Decimal [(M,D)] |
|
Distinguish Zerofill: When declaring a keyword Zerofill to fill 0 automatically, such as 000021
Iii. Date and time
Type |
Range |
Description |
Date |
Date (YYYY-MM-DD) |
|
Time |
Time (HH:MM:SS) |
|
Datetime |
Date and time combination (Yyyy-mm-dd hh:mm:ss) |
|
TimeStamp |
Yyyymmddhhmmss |
|
Year |
Year yyyy |
|
Tinytext, text, Mediumtext and Longtext in MySQL