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.
The day before yesterday group Tube asked me what is the difference between int (10) and int (11), then think is the difference between the length, now look, they are in addition to the time of storage in a slightly different, when we use the time there is no difference. an int (10) can also represent a value of 2147483647 for which int (11) can also be represented.
To see the different effects remember to add the Zerofill value when creating the type, indicating that it is filled with 0, otherwise the effect is not visible.
We don't usually add this option when we create a database, so we can say there's no difference between them.
That which didn ' t kill me makes me stronger
When the Declaration field is of type int, int is four bytes, a byte 8 bits, or 4*8=32, the number of digits that can be represented is 2 32 (2^32 = 4 294 967 296 digits).
4 294 967 296 numbers that is 0~4 294 967 295, of course, if you distinguish the sign, the number will be smaller.
Take a look at the picture below
What is the difference between an int (3) and an int (11) in MySQL?