Home > Database > Mysql Tutorial > MySQL BigInt Zerofill 与 int Zerofill?

MySQL BigInt Zerofill 与 int Zerofill?

WBOY
Release: 2023-08-28 15:37:06
forward
1426 people have browsed it

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)
Copy after login

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)
Copy after login

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

mysql> select *from BigintandintDemo;
Copy after login

The following is the output -

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

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template