MySQL BigInt Zerofill 与 int Zerofill?

WBOY
发布: 2023-08-28 15:37:06
转载
1397 人浏览过

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.com
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!