MySQL数据类型

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());


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值