1、bigint(10)和bigint(20)的區別在於如果表定義加上zerofill后再客戶端顯示長度不同,如下:
| MariaDB [test]> create table test2 (id bigint(10) zerofill, -> id1 bigint(20) zerofill); MariaDB [test]> insert into test2 values(1,2); MariaDB [test]> select * from test2; id id1 0000000001 00000000000000000002 |
2、如果在創建bigint字段時,不指定長度,則默認長度為20,如下:
|
mysql> create table test3 (id bigint); Query OK, 0 rows affected mysql> show create table test3; Table Create Table test3 CREATE TABLE `test3` ( `id` bigint(20) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|---|
3、無論是bigint(10),還是bigint(20)均占用8個字節,int和tinyinit類型類似。
