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

a 夏天 提交于 2020-01-10 22:47:32

问题


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

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


回答1:


Check the manual of the RDBMS you're using. It may not be the same in all systems.

MySQL:
https://dev.mysql.com/doc/refman/5.7/en/integer-types.html

PostgreSQL:
https://www.postgresql.org/docs/10/static/datatype-numeric.html

SQL Server (Transact-SQL):
https://docs.microsoft.com/en-us/sql/t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql

DB2:
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.sqlref/db2z_biginteger.htm




回答2:


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

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




回答3:


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

See the Numeric Types section of the docs for the full details.




回答4:


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

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



来源:https://stackoverflow.com/questions/4408808/what-is-the-limit-of-the-field-type-bigint-in-sql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!