search

Home  >  Q&A  >  body text

mysql - 为什么 phpmyadmin 创建的数据表 int 默认为 int(11)

int 最大长度不是 int(10) 吗,但是现在使用最新版本的phpmyadmin,创建数据表,如果选择类型为int,默认长度变成了 11,这个是一种趋势吗

巴扎黑巴扎黑2787 days ago656

reply all(2)I'll reply

  • 迷茫

    迷茫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.

    reply
    0
  • 黄舟

    黄舟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.

    reply
    0
  • Cancelreply