I would like to make a quick MySQL 101 about numeric types in MySQL and especially explain the difference between the numeric type attributes and the maximum value that a numeric type can store.
Someone asked me yesterday why when he inserts a value in a
table, the value 127 appears instead of the value 160 that he’s
just inserted.
Ok, let me explain, consider this table :
What happens if you want to insert this row in the table :
sql > insert into product values (160, 554, "iPad mini"); Query OK, 1 row affected, 1 warning (0.01 sec) sql > show warnings; +---------+------+---------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------+ | Warning | 1264 | Out of range value for column 'id' at row 1 | …[Read more]