1.MySQL字段类型
类型 取值范围
CHAR(N) 0~255
VARCHAR(N) 0~65536
TINYBLOB 0~255
BLOB 0~65535
MEDUIMBLOB 0~167772150
LONGBLOB 0~4294967295
TINYTEXT 0~255
TEXT 0~65535
MEDIUMTEXT 0~167772150
LONGTEXT 0~4294967295
VARBINARY(N) 0~N个字节的变长字节字符集
BINARY(N) 0~N个字节的定长字节字符集
MySQL数据类型(上)
1)create table t(a int(11) zerofill, b int(21) zerofill);
2)insert into t values (1, 1);
3)select * from t;
4)create table t(a int(11), b int(21));
5)create table t(a int(11) default null, b float(7, 4) default null) engine=innodb default charset=utf8;
6)insert into t values (2, 123.12345);
7)select * from t;
MySQL数据类型(下)
1)create table t (a char(256));
2)create table t (a varchar(256));
3)create table test (a datetime, b timestamp);
4)show create table test\G
5)select now();
6)insert into test values (now(), now());
7)select * from test;
8)set time_zone = '+00:00';
9)select * from test;
10)set time_zone = '+08:00';
11)select from_unxtime(1439523443);
12)select now();
13)select unix_timestamp(now());