MySQL Optimization-data type width and mysql Data Type width
Reprinted please indicate the source: http://blog.csdn.net/l1028386804/article/details/46559861
You can specify the display width for All Integer Data Types in MYSQL.
Create a table
Create table tb_emp (id BIGINT (1 ))
The data type of the id field is BIGINT (1). Note the following number 1, which indicates the display width specified by the data type and the number of digits that can be displayed.
For example, if you declare a field of the INT type year int (4), this statement specifies that the data in the year field generally only shows the width of four digits.
The display width is irrelevant to the value range of the data type. The display width only specifies the maximum number of digits that MYSQL may display. When the number of digits is smaller than the specified width, spaces are filled. If a value greater than the display width is inserted, as long as the value does not exceed the value range of this type of integer, the value can still be inserted and displayed.
For example, if you insert a value of 19999 into the year field and use the select statement to query data, MYSQL displays a full value of 19999 with five digits instead of a four-digit value.
If the display width is not specified, MYSQL specifies the default width for each type.
Note: The display width is only used for display, and the value range and occupied space cannot be limited. For example, INT (3) occupies 4 bytes of storage space, in addition, the maximum value is not 999, but the maximum value allowed by the INT type.