Why can't I insert 10 digits when my column is INT(10)

后端 未结 6 1788
孤独总比滥情好
孤独总比滥情好 2021-01-17 05:24

I have this column that\'s INT(10) ZEROFILL NOT NULL DEFAULT \'0000000000\',

But when I insert something like 9100000010, I get 42949

6条回答
  •  情歌与酒
    2021-01-17 06:18

    In MySQL, INT(10) does not mean that values are limited to 10-character values. It only means that MySQL will try to pad these values with spaces/zeroes when returning them.

    The numeric range of any signed INT including INT(10), INT(5) or any other INT(n) is: -2,147,483,648 ... 2,147,483,647, which is 10 digits at most.

提交回复
热议问题