Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the Maximum Value of smallint(6) unsigned in MySQL?

Tags:

types

sql

mysql

What's the maximum value of smallint(6) unsigned in MySQL?

like image 605
Steven Avatar asked Nov 05 '09 04:11

Steven


People also ask

What is max value of Smallint?

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.

What is the maximum value of Smallint data type when set to unsigned?

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.

What is Smallint unsigned?

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.

What does Smallint 5 mean in SQL?

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.


2 Answers

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.

like image 92
longneck Avatar answered Sep 22 '22 12:09

longneck


An smallint unsigned max value is 65535 and uses 2 bytes

MySQL Reference

like image 42
Herbert Marshall Avatar answered Sep 24 '22 12:09

Herbert Marshall