mysql int(10) int(11) bigint(11) bigint(20) 区别

1,977 阅读1分钟

For integer data types, M indicates the maximum display width. The maximum display width is 255. Display width is unrelated to the range of values a type can store

说明int(M)中的M是显示宽度, 不会影响类型的取值范围.

所以

  • int(10) int(11) 取值范围 没有区别,

  • bigint(11) bigint(20) 取值范围 没有区别

  • 建表时, 直接写 int/bigint 就行了.

  • learnku.com/articles/36…

dev.mysql.com/doc/refman/…

类型位数
int32
bigint64