Original address: 76549503
Today when adding data, I found that when the data type is int (11), I then let the user add data, the maximum input length is 11 bits, the result, add data add not, cause the problem, I changed to the maximum length of 10 bits, the results verify 9 1 is normal, Again, the 9-9 test failed again.
After querying the information, finally found the data type in MySQL int (11) Introduction
In the SQL statement, int represents the type of field you want to create, int represents an integer, and 11 represents the length of the field.
This 11 represents the width of the display, the display width of the whole series and how many characters MySQL needs to display the column value, which is not related to the size of the storage space required by the integer, for example, regardless of how many characters the display width is set, bigint consumes 8 bytes.
int is integer, (11) is the length of the display character, but to add the parameter, the maximum is 255, for example, it is the ID of the number of records, insert 10 data, it shows 00000000001 ~~~00000000010, when the number of characters more than 11, it only shows 11 bits, If you don't add the argument that makes it less than 11 bits ahead plus 0, it won't add 0 to the front.
When declaring an integer data column, we can assign it a display width of M (1~255), such as int (5), specify a display width of 5 characters, and if it does not specify a display width, MySQL assigns it a default value. The display width is only used for display, and cannot limit the range of values and footprint, such as: Int (3) consumes 4 bytes of storage space, and the maximum allowed value is not 999, but the maximum allowed for int integer type.
MySQL has five types of integer data columns-Tinyint,smallint,mediumint,int and bigint. The difference between them is that the range of values is different and the storage space varies.
Adding the unsigned property to an integer data column suppresses negative numbers, starting with 0.
Note: M here is not a specific length stored in the database, it was always mistaken for int (3) to store only 3-length numbers, and int (11) would store 11-length numbers, which is a big mistake. In fact, when we choose the type of int, whether it is int (3) or int (11), it is stored in the database is 4 bytes of length, when using int (3) If you enter 10, will default to you storage bit 010, This means that the 3 is the default length, and when you are less than 3, it will help you not all, when you have more than 3 bits, there is no effect. What is the difference between int (10) and int (11), when I think it is the difference of length, now look, there is a little difference between them in the storage, but there is no difference when we use it. an int (10) can also represent a value of 2147483647 for which int (11) can also be represented.
What is the maximum length of int (11) in the
[]mysql]?