当前位置:Gxlcms > 数据库问题 > MySQL的bigint类型

MySQL的bigint类型

时间:2021-07-01 10:21:17 帮助过:2人阅读

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(*): 4
1 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: 9223372036854775807
4 rows in set (0.00 sec)

mysql>

MySQL的bigint类型

标签:set   sele   支持   from   back   符号   war   val   sel   

人气教程排行