Home  >  Article  >  Database  >  MySQL BigInt Zerofill 与 int Zerofill?

MySQL BigInt Zerofill 与 int Zerofill?

WBOY
WBOYforward
2023-08-28 15:37:061398browse

MySQL BigInt Zerofill 与 int Zerofill?

MySQL The difference between BigInt and int is that INT is 32 bits long while BIGINT is 64 bits long.

Here are some key points -

  • BigInt occupies 8 bytes of storage space while int occupies 4 bytes of storage space.

  • int occupies the maximum value of 4294967295 for int(10) and 18,446,744,073,709,551,615 for bigint(20).

  • BigInt(20) and int(10), where 20 and 10 are available for zero-padded width display.

Here is a demo for Bigint and int with zero padding. Below is the query to create the table.

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

Now you can insert records into the table. The query is as follows -

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

Use the select statement to display all records in the table. The query is as follows -

mysql> select *from BigintandintDemo;

The following is the output -

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

The above is the detailed content of MySQL BigInt Zerofill 与 int Zerofill?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete