Display width
The integer data type in MySQL can specify the display width, and SQL Server does not
Create a table
CREATE TABLE tb_emp (id BIGINT (1))
The ID field has a data type of bigint (1), noting the subsequent number 1, which represents the display width specified by the data type, specifying the number of digits in the numeric value that can be displayed.
For example, suppose you declare a field of type int of year int (4)
The declaration indicates that the data in the year field generally shows only the width of a 4-digit number.
It's going to be an error in SQL Server.
CREATE TABLE ABC (ID INT (11))
Msg 2716, Level 16, State 1, 1th row 1th column, parameter, or variable: column widths cannot be specified for data type int.
The display width and the value range of the data type are irrelevant. Display width only indicates the maximum number of digits that can be displayed by MySQL, and a space padding when the number of digits is less than the specified width
If a value greater than the display width is inserted, the value can be inserted and displayed as long as it does not exceed the range of values for that type of integer.
For example, to insert a numeric value of 19999 into the year field, when using a select query, MySQL will display a full 5-digit 19999 instead of a 4-bit number
If you do not specify a display width, mysql specifies a default width value for each type
Tips: The display width is for display only, and cannot limit the range and footprint, for example: Int (3) consumes 4 bytes of storage, and the maximum allowable value is not 999, but int integer
The maximum allowable value.
My MySQL learning Experience (ii) data type width