After defining the int data type in mysql, what is the length entered later? The following describes the length of the int data type in mysql.
In mysql, the maximum length of the int data type is 11 bits and the minimum length is 4 bits.
This optional width specification is used to show the left fill of values whose width is shorter than the column width when the value is displayed, instead of limiting the width of the value stored in the column, or limiting the number of digits that can be displayed that exceed the specified width of the column. Note: If you store a larger value in an integer column that exceeds the display width, you may encounter problems when mysql generates temporary tables for some complex joins, in this case, mysql trust that all values are suitable for the original column width.
In mysql, int itself is 4 bytes. bigint is 8 bytes. So the meaning of int (X) is that int determines the size of the expected data column in bytes X.
In an SQL statement, int indicates the type of the field to be created, int indicates the integer type, and 11 indicates the length of the field.
The display width of an integer column is different from the number of characters required by mysql to display the value of this column. It has nothing to do with the size of the storage space required by this integer. For example, no matter how many characters the display width is set, bigint occupies 8 bytes.
MySQL inserts multiple records using INSERT
General INSERT usage in MySQL
Range of MySQL numeric data types
MySQL index type
This section describes the TIMESTAMP type in MYSQL.