PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

MySQL BigInt Zerofill 与 int Zerofill?

WBOY
WBOY 转载
2023-08-28 15:37:06 1107浏览

MySQL BigInt Zerofill 与 int Zerofill?

MySQL BigInt 和 int 之间的区别在于 INT 是 32 位长,而 BIGINT 是 64 位长。

以下是一些要点 -

  • BigInt 占用 8 个字节的存储空间,而 int 占用 4 个字节的存储空间。

  • int 占用 int(10) 的最大值 4294967295 ,而 bigint(20) 为 18,446,744,073,709,551,615。

  • BigInt(20) 和 int(10),其中 20 和 10 可用于零填充的宽度显示。

这里是 Bigint 和 int 带零填充的演示。以下是创建表的查询。

mysql> create table BigintandintDemo
   −> (
   −> Number1 bigint zerofill,
   −> Number2 int zerofill
   −> );
Query OK, 0 rows affected (0.62 sec)

现在您可以在表中插入记录。查询如下 -

mysql> insert into BigintandintDemo values(234556667777,678999);
Query OK, 1 row affected (0.17 sec)

借助 select 语句显示表中的所有记录。查询如下 -

mysql> select *from BigintandintDemo;

以下是输出 -

+----------------------+------------+
| Number1              | Number2    |
+----------------------+------------+
| 00000000234556667777 | 0000678999 |
+----------------------+------------+
1 row in set (0.00 sec)

以上就是MySQL BigInt Zerofill 与 int Zerofill?的详细内容,更多请关注php中文网其它相关文章!

声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除