首頁  >  文章  >  資料庫  >  MySQL BigInt Zerofill 與 int Zerofill?

MySQL BigInt Zerofill 與 int Zerofill?

WBOY
WBOY轉載
2023-08-28 15:37:061398瀏覽

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刪除