Home >Database >Mysql Tutorial >What is the Size and Maximum Value of a MySQL INT(11) Column?

What is the Size and Maximum Value of a MySQL INT(11) Column?

DDD
DDDOriginal
2024-12-11 06:19:12651browse

What is the Size and Maximum Value of a MySQL INT(11) Column?

Determining the Size and Maximum Value of an INT(11) Column in MySQL

In MySQL, an INT(11) column has a fixed length of 4 bytes, regardless of the specified length. This is because INT data types always occupy 4 bytes.

Byte Size Comparison

To compare the sizes of different integer data types in MySQL, consider the following:

  • TINYINT: 1 byte (8 bits)
  • SMALLINT: 2 bytes (16 bits)
  • MEDIUMINT: 3 bytes (24 bits)
  • INT: 4 bytes (32 bits)
  • BIGINT: 8 bytes (64 bits)

Length and Padding

While the length specified for INT(11) columns does not affect the actual storage size, it determines the padding behavior when retrieving data using the MySQL command line client. For example, if 12345 is stored in an INT(3) column, it will still display as 12345. However, if it is stored in an INT(10) column, it can be displayed with padding, such as 0000012345 with the ZEROFILL option.

Maximum Value

The maximum value that can be stored in an INT(11) column depends on whether it is signed or unsigned:

  • Signed: 2,147,483,647
  • Unsigned: 4,294,967,295

The above is the detailed content of What is the Size and Maximum Value of a MySQL INT(11) Column?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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