Storage Size and Range of INT(11) Column in MySQL
The storage size of a column of type INT(11) in MySQL is consistently 4 bytes, regardless of the length specified. This information is crucial when designing database schemas to meet specific storage requirements.
MySQL supports several integer data types, including:
The length parameter in INT(11) is used to specify how many characters should be padded when selecting data from the database. However, it does not affect the actual storage size of the numeric value.
For example, storing the value 12345 in an INT(3) column will still result in the same 4-byte storage size. However, when selecting data with the MySQL command line client, it will be displayed with three leading zeros (e.g., 00012345) to match the specified length.
The maximum value that can be stored in an INT(11) column is 2,147,483,647 for signed integers and 4,294,967,295 for unsigned integers. These values align with the signed and unsigned limits for 32-bit integers, which represent the underlying storage type.
The above is the detailed content of Does MySQL's INT(11) Column Really Use 11 Bytes of Storage?. For more information, please follow other related articles on the PHP Chinese website!