bigint(10)和bigint(20)的區別


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類型類似。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM