When creating a database field and encountering a numeric type, such as int (4), I once thought it was a length. Later I tested it and found that no matter how many fields I set, the length of the inserted data is not affected. The related explanations are as follows:
From: http://www.ccvita.com/175.html
Meaning of X in MySQL int (X)
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.
Int itself is 4 bytes. bigint is 8 bytes. So the meaning of int (X) is that int determines the bytes in data storage. X represents the expected column width.
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.
This indicates the display width.
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.
From: http://matt-u.javaeye.com/blog/380670
As an extension to the ANSI/ISO sql92 standard, MySQL also supports integer types such as tinyint, mediumint, and bigint. Another extension is that MySQL allows you to specify the display format of an integer value at will, which is achieved through the basic keyword of the type followed by a bracket (for example, INT (4 )). 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. When used together with the optional extension property zerofill, the space filled by default is replaced by zero. For example, a column is defined as int (5) zerofill, And the inserted value 4 is 00004 when retrieved. 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.
However, I have never tried zerofill in MySQL (Windows.