Hi.
Check out
10.2. Numeric Types in the manual. You can see the range list for all integer types there.
In short, a normal Integer is 4 bytes, so it's ranges are:
- -2,147,483,648 to 2,147,483,647 (Signed)
- 0 to 4,294,967,295 (Unsigned)
The number you specify when you create the field (for example, INT(4)) defines the
display width of the field, not the amount of data it can hold.
It is meant as a guideline to applications that should left-pad the number when displayed.
If you create the number with the optional ZEROFILL attribute, MySQL will do this automatically for you.
For example, a column defined as:
Int(5) ZEROFILL, containing the number 1, would output:
00001
But even if the number you insert is larger than the display width, MySQL will not truncate it.
(Given that it is not larger than the maximum for the type)