mysql的int 11,MYSQL中int(11)数据类型面临的问题

I have a table in MYSQL in with a primary key id int(11) (auto-incremented). Now I have a program which reads some text file and enters the value in id column.

So my table should contains :

id

897413

791783

But what happens is that, I can't find big numbers in my table. Is this because of maximum value that int(11) can hold? Increased int(11) to int(20) still facing same problem. I can't change the datatype to big int as I have already implemented a lot of code.

EDIT:

I tried to insert a single record with id as 523826 and it got saved in DB as 450258. Why so?

解决方案

Definition from mysql manual for the int data type:

A normal-size integer. The signed range is -2147483648 to 2147483647. The unsigned range is 0 to 4294967295.

The int type is always 4 bytes (32 bits). The 11 in int(11) is just the "display width", that only matters for UNSIGNED ZEROFILL columns. More details on this blog post.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值