gpt4 book ai didi

sql - BIGINT(8) 是 MySQL 可以存储的最大整数吗?

转载 作者:IT老高 更新时间:2023-10-28 12:58:46 28 4
gpt4 key购买 nike

我现在有一些数字超出了 INT 的处理能力。

这有点尴尬,但我真的不知道 BIGINT(8) 到底是什么意思。其中的8是最大位值还是最大长度?

所以 BIGINT(1) 只能是一位数?或者是 BIGINT(1) 别的什么?我认为 TINYINT(1) 最大值是 127,结果如何?

  • BIGINT我能做的最大的事情是什么?
  • 我可以在 MySQL 中以整数形式存储的最大数字是多少?

最佳答案

数字代表它的显示方式 - 它不影响数据的存储方式。

来自 the manual :

Another extension is supported by MySQL for optionally specifying the display width of integer data types in parentheses following the base keyword for the type (for example, INT(4)). 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.)

The display width does not constrain the range of values that can be stored in the column, nor the number of digits that are displayed for values having a width exceeding that specified for the column. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range allowed by three characters are displayed using more than three characters.

BIGINT 始终为 8 个字节,可以存储 -9223372036854775808 到 9223372036854775807(有符号)或 0 到 18446744073709551615(无符号)。

关于sql - BIGINT(8) 是 MySQL 可以存储的最大整数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1632312/

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