MySQL BigInt Zerofill 与 int Zerofill?

2023年 8月 28日 35.2k 0

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?的详细内容,更多请关注每日运维网(www.mryunwei.com)其它相关文章!

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论