BIGINT(8)是MySQL能儲存的最大整數嗎?
在BIGINT(8)中,編號8表示資料將如何顯示。它不會影響儲存。該編號用於顯示寬度。
BIGINT佔用8個位元組,即64位。有符號範圍為-9223372036854775808到9223372036854775807,無符號範圍採用正值。無符號的範圍為0到18446744073709551615。
為了理解bigint(8),我們建立一個具有BIGINT(8)和zerofill列的表格−
mysql> create table BigIntDemo8 -> ( -> Number1 BIGINT(8) not null, -> Number2 BIGINT(8) unsigned zerofill not null -> ); Query OK, 0 rows affected (0.59 sec)
為這兩列插入一些記錄。插入記錄的查詢如下−
mysql> insert into BigIntDemo8 values(1,1); Query OK, 1 row affected (0.14 sec) mysql> insert into BigIntDemo8 values(11,11); Query OK, 1 row affected (0.24 sec) mysql> insert into BigIntDemo8 values(111,111); Query OK, 1 row affected (0.14 sec) mysql> insert into BigIntDemo8 values(1111,1111); Query OK, 1 row affected (0.18 sec) mysql> insert into BigIntDemo8 values(11111,11111); Query OK, 1 row affected (0.10 sec) mysql> insert into BigIntDemo8 values(111111,111111); Query OK, 1 row affected (0.21 sec)
使用select語句從表格中顯示所有記錄。查詢如下−
mysql> select *from BigIntDemo8;
以下是輸出−
+---------+----------+ | Number1 | Number2 | +---------+----------+ | 1 | 00000001 | | 11 | 00000011 | | 111 | 00000111 | | 1111 | 00001111 | | 11111 | 00011111 | | 111111 | 00111111 | +---------+----------+ 6 rows in set (0.00 sec)
廣告