What does INT(5) in mysql mean?

前端 未结 7 457
孤独总比滥情好
孤独总比滥情好 2020-12-29 18:27

I always thought INT(5) means a number which has a max size of 5 digits. I tried entering a huge number inside it and it somehow got cut down to 2147483647

This obvi

7条回答
  •  萌比男神i
    2020-12-29 19:31

    In MySQL, INT(5) does not mean that values are limited to 5-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.

提交回复
热议问题