SQL 中字段类型 BIGINT 的限制是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4408808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 08:32:44  来源:igfitidea点击:

What is the limit of the field type BIGINT in SQL?

sqlbigint

提问by ozsenegal

What is the limit of the field type BIGINT in SQL?

SQL 中字段类型 BIGINT 的限制是什么?

is 100000235882380 or 100000466411115 acceptable? (That is ID from facebook)

100000235882380 或 100000466411115 是否可以接受?(那是facebook的ID)

回答by Andrew Hare

Yes, according to int, bigint, smallint, and tinyint (Transact-SQL):

是的,根据int、bigint、smallint 和 tinyint (Transact-SQL)

bigint-2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)

大整数-2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)

回答by John Parker

It depends on the RDBMS. For example, the maxiumum values of a BIGINT are 9223372036854775807(for signed) or 18446744073709551615(for un-signed) on MySQL.

这取决于 RDBMS。例如,BIGINT 的最大值在 MySQL 上是9223372036854775807(对于有符号的)或18446744073709551615(对于无符号的)。

See the Numeric Typessection of the docs for the full details.

有关完整详细信息,请参阅文档的数字类型部分。

回答by rustyx

Nothing to worry about. BIGINT can store much larger values than the ones you have.

没什么可担心的。BIGINT 可以存储比您拥有的值大得多的值。

At a minimum up to 9,223,372,036,854,775,807.

最低可达 9,223,372,036,854,775,807。