Signed or unsigned in MySQL

According to section 10.2 of the MySQL 5.1 Manual:

In non-strict mode, when an
out-of-range value is assigned to an
integer column, MySQL stores the value
representing the corresponding
endpoint of the column data type
range. If you store 256 into a TINYINT
or TINYINT UNSIGNED column, MySQL
stores 127 or 255, respectively. When
a floating-point or fixed-point column
is assigned a value that exceeds the
range implied by the specified (or
default) precision and scale, MySQL
stores the value representing the
corresponding endpoint of that range.

So using UNSIGNED is really only necessary when you are concerned about the upper bound. Also adding UNSIGNED does not affect the size of the column just how the number is represented.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)