int 最大长度不是 int(10) 吗,但是现在使用最新版本的phpmyadmin,创建数据表,如果选择类型为int,默认长度变成了 11,这个是一种趋势吗
迷茫2017-04-17 11:55:10
The number after int has nothing to do with space usage and execution efficiency.
It is only used for display format, that is, when the field is set to ZEROFILL
.
When used in conjunction with ZEROFILL
, the default supplementary spaces are replaced with zeros.
Without ZEROFILL
, this number is meaningless.
As for why it is int(11), not int(10).
Because for example, -2147483648
or something is 11, and if UNSIGNED
is set, it will be 10.
黄舟2017-04-17 11:55:10
int
occupies 4 bytes. If it is unsign
, the storage range is 0 - 4294967295
int
The following numbers will not affect storage and have no impact on the actual stored value. No matter what the following number is, it has no practical effect. A int
only occupies four bytes.
only works when displayed on the client and must have the zerofill
attribute.