bigint支持的数字的大小范围为:19位,存电话号码。有符号范围:-9223372036854775808 到 9223372036854775807
int支持的数字范围为:10位,有符号范围:-2147483648 到 2147483647 无符号范围:0-4294967295
mysql> create table c5(id bigint);
Query OK, 0 rows affected (0.04 sec)mysql> insert into c5 values(23434);
Query OK, 1 row affected (0.01 sec)mysql> insert into c5 values(44444444444444423434);
Query OK, 1 row affected, 1 warning (0.00 sec)mysql> insert into c5 values(444444444444444444444444444444444444444444423434);
Query OK, 1 row affected, 1 warning (0.00 sec)mysql> insert into c5 values(444444444444444444444444444444444444444444423434444444444444444444444444444);
Query OK, 1 row affected, 1 warning (0.00 sec)插入一个大的数值并不报错,但实际存到表里面的数据就是19位数字支持的最大数字
mysql> select * from c5;
+---------------------+| id |+---------------------+| 23434 || 9223372036854775807 || 9223372036854775807 || 9223372036854775807 |+---------------------+4 rows in set (0.00 sec)mysql> select count(*) from c5;
+----------+| count(*) |+----------+| 4 |+----------+1 row in set (0.00 sec)mysql> select count(*) from c5\G
*************************** 1. row ***************************count(*): 41 row in set (0.00 sec)mysql> select * from c5\G
*************************** 1. row ***************************id: 23434*************************** 2. row ***************************id: 9223372036854775807*************************** 3. row ***************************id: 9223372036854775807*************************** 4. row ***************************id: 92233720368547758074 rows in set (0.00 sec)mysql>
那么comment的作用是什么呢? 字面上的意思 备注 , 查看设计表就知道了。
show create table 表名;
CREATE TABLE `tests` ( `id` bigint(20) NOT NULL COMMENT 'ID', `tenant_it` bigint(20) NOT NULL COMMENT '租户ID') ENGINE=InnoDB DEFAULT CHARSET=utf8