I know that the number inside parenthesis does not control the storage limit; but I am curious why it is popular to write INT(11)
when it only stores 10 digits (unsigned 4,294,967,295). Using numbers smaller than the capacity like tinyint(1)
is understandable but why higher?
A signed integer is 11: 10 digits + 1 sign
An unsigned integer is 10.
That's because the 11 counts the sign digit
When dealing with the INT type, the "size" is the display size. An INT is 4 bytes.
The extra (10 + 1) is for the minus sign. If you make it an unsigned int, the size will default to 10 instead of 11.
There would be no reason to go beyond 11.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With