1.数值类型
MYSQL支持所有标准SQL,这其中包括:
作为对标准SQL的扩展,MySQL还支持TINYINT,MEDIUMINT及BIGINT,如下图:
Type | Bytes | Minimum Value | Maximum Value |
(Signed/Unsigned) | (Signed/Unsigned) | ||
TINYINT |
1 | -128 |
127 |
0 |
255 |
||
SMALLINT |
2 | -32768 |
32767 |
0 |
65535 |
||
MEDIUMINT |
3 | -8388608 |
8388607 |
0 |
16777215 |
||
INT |
4 | -2147483648 |
2147483647 |
0 |
4294967295 |
||
BIGINT |
8 | -9223372036854775808 |
9223372036854775807 |
0 |
|
Data Type |
“Zero” Value |
DATETIME |
'0000-00-00 00:00:00' |
DATE |
'0000-00-00' |
TIMESTAMP |
'0000-00-00 00:00:00' |
TIME |
'00:00:00' |
YEAR |
0000 |
自动初始化与更新 | ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP |
自动初始化 | ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
自动更新 | ts TIMESTAMP DEFAULT 0 NO UPDATE CURRENT_TIMESTAMP |
无 | ts TIMESTAMP DEFAULT 0 |
SET Member |
Decimal Value |
Binary Value |
'a' |
1 |
0001 |
'b' |
2 |
0010 |
'c' |
4 |
0100 |
'd' |
8 |
1000 |