Home > Common Problem > What is mysql long integer?

What is mysql long integer?

百草
Release: 2023-06-14 16:30:32
Original
2845 people have browsed it

MySQL long integer type is "BIGINT", which is one of the most commonly used data types in MySQL. It can be used to store larger integer values. Like other integer data types, it can be signed or unsigned. Signed, the signed data type means that the column can store positive and negative integer values, while the unsigned data type means that the column can only store positive integer values, and the range of the long integer is -2^63 to 2^63-1 between, its definition syntax is "BIGINT[(M)] [UNSIGNED] [ZEROFILL]".

What is mysql long integer?

The operating system of this tutorial: Windows 10 system, mysql version 8.0, Dell G3 computer.

What is MySQL Long Integer

MySQL Long Integer (Long Integer) is an integer data type in MySQL, used to store integer values. BIGINT, like other integer data types, can be signed or unsigned; the signed data type means that the column can store positive and negative integer values, while the unsigned data type means that the column can only store positive integer values. It ranges from -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807). The long integer data type in MySQL can store larger integer values, such as user IDs, order numbers, etc. The definition syntax of MySQL long integer is as follows:

BIGINT[(M)] [UNSIGNED] [ZEROFILL]
Copy after login

Among them, M indicates the maximum number of digits in the value, UNSIGNED indicates that the stored value is a positive number, and ZEROFILL indicates that the stored value is filled with 0s in front to reach the specified number of digits. .

Use of MySQL long integer

MySQL long integer can be used to store larger integer values, such as user ID, order number, etc. The syntax for using MySQL long integer is as follows:

CREATE TABLE table_name 
(
   column1 BIGINT, 
   column2 BIGINT UNSIGNED, 
   column3 BIGINT(20) ZEROFILL
 );
Copy after login

The above statement creates a table named table_name, which has 3 columns, namely column1, column2, and column3. Their data types are all long integer. , the numerical range of column1 and column2 is between -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807); the numerical range of column3 is between 0 and 999999999999999999999, and its value is filled with 0 in front , to achieve the specified number of digits.

The above is the detailed content of What is mysql long integer?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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