int mysql是什么意思_MySQL数据类型 int什么意思

MySQL数据类型 int什么意思

关注:136  答案:2  mip版

解决时间 2021-01-30 21:51

e6cb1a03ad541b3098697807b7bf1798.png

提问者叫我女王

2021-01-30 10:52

MySQL数据类型 int什么意思

最佳答案

e6cb1a03ad541b3098697807b7bf1798.png

二级知识专家那年仲夏

2021-01-30 12:08

从 -2^31 (-2,147,483,648) 到 2^31 – 1 (2,147,483,647) 的整型数据(所有数字)。存储大小为 4 个字节。int 的 SQL-92 同义字为 integer。

全部回答

e6cb1a03ad541b3098697807b7bf1798.png

1楼错过の花开

2021-01-30 13:32

int(m) zerofill,加上zerofill后m才表现出有点点效果,比如 int(3) zerofill,你插入到数据库里的是10,则实际插入为010,也就是在前面补充加了一个0.如果int(3)和int(10)不加 zerofill,则它们没有什么区别.m不是用来限制int个数的.int(m)的最大值和最小值与undesigned有关,最下面那副图有说明.

mysql> create table t (t int(3) zerofill);

query ok, 0 rows affected (0.00 sec)

mysql> insert into t set t = 10;

query ok, 1 row affected (0.00 sec)

mysql> select * from t;

+——+

| t |

+——+

| 010 |

+——+

1 row in set (0.11 sec)

zerofill with default width, the same as int(10):

mysql> create table t (t int zerofill);

query ok, 0 rows affected (0.02 sec)

mysql> insert into t set t = 10;

query ok, 1 row affected (0.02 sec)

mysql> select * from t;

+————+

| t |

+————+

| 0000000010 |

+————+

1 row in set (0.08 sec)

without zerofill:

mysql> create table t (t int);

query ok, 0 rows affected (0.01 sec)

mysql> insert into t set t = 10;

query ok, 1 row affected (0.01 sec)

mysql> select * from t;

+——+

| t |

+——+

| 10 |

+——+

1 row in set (0.00 sec)

我要举报

如以上问答内容为低俗/色情/暴力/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!

→点此我要举报以上信息!←

推荐资讯

大家都在看

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值