Monday, December 30, 2024

UNSIGNED

This is an optional attribute for a column definition of a numeric data type. By default, all numeric columns store SIGNED values, the use of UNSIGNED can increase the range when only positive INTEGER values are needed.

The following table shows the maximum range of values for SIGNED and UNSIGNED numeric data types.

Datatype SIGNED UNSIGNED
TINYINT -128 to 127 0 to 255
SMALLINT -32768 to 32767 0 to 65535
MEDIUMINT -8388608 to 8388607 0 to 16777215
INT -2147483648 to 2147483647 0 to 4294967295
BIGINT -9223372036854775808 to 9223372036854775807 0 to 18446744073709551615

For more information see the MySQL Reference Manual Numeric Types.