What is the limit of the field type BIGINT in SQL?
is 100000235882380 or 100000466411115 acceptable? (That is ID from facebook)
A big integer is a binary integer with a precision of 63 bits. The range of big integers is -9223372036854775808 to +9223372036854775807.
The 20 in INT(20) and BIGINT(20) means almost nothing. It's a hint for display width. It has nothing to do with storage, nor the range of values that column will accept.
A BIGINT is always 8 bytes and can store -9223372036854775808 to 9223372036854775807 (signed) or 0 to 18446744073709551615 (unsigned).
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
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With