gpt4 book ai didi

mysql - mysql中的INT(5)是什么意思?

转载 作者:IT老高 更新时间:2023-10-28 23:41:40 26 4
gpt4 key购买 nike

我一直认为 INT(5) 表示一个最大大小为 5 位的数字。我尝试在其中输入一个巨大的数字,但不知何故它被缩减为 2147483647

这显然不是 5 位数。那么INT(5)有什么限制呢?

最佳答案

来自 MySQL Docs, Numeric Type Attributes

MySQL supports an extension for optionally specifying the display width of integer data types in parentheses following the base keyword for the type. For example, INT(4) specifies an INT with a display width of four digits. This optional display width may be used by applications to display integer values having a width less than the width specified for the column by left-padding them with spaces. (That is, this width is present in the metadata returned with result sets. Whether it is used or not is up to the application.)

关于mysql - mysql中的INT(5)是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8892341/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com