ホームページ  >  記事  >  データベース  >  MySQL BigInt Zerofill と int Zerofill?

MySQL BigInt Zerofill と int Zerofill?

WBOY
WBOY転載
2023-08-28 15:37:061402ブラウズ

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 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はtutorialspoint.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。