What's the maximum value of smallint(6) unsigned
in MySQL?
The SMALLINT data type stores small whole numbers that range from –32,767 to 32,767. The maximum negative number, –32,768, is a reserved value and cannot be used. The SMALLINT value is stored as a signed binary integer.
SMALLINT is a small integer. The SMALLINT range for SIGNED values is from -32768 to 32767. The minimum and maximum values for SMALLINT UNSIGNED are 0 and 65535 respectively.
Description. A small integer. The signed range is -32768 to 32767. The unsigned range is 0 to 65535. If a column has been set to ZEROFILL, all values will be prepended by zeros so that the SMALLINT value contains a number of M digits.
The (5) is smallint(5) or int(5) is called a "Numeric Type Attribute" and it represents the "display width" of the field, MySQL supports an extension for optionally specifying the display width of integer data types in parentheses following the base keyword for the type.
According to official MySQL documentation, the maximum value of an unsigned smallint is 65535.
The (6)
portion has no effect on the allowed range of the column; it only affects the display of the column in the MySQL command line interface.
An smallint unsigned max value is 65535 and uses 2 bytes
MySQL Reference
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