Hot answers tagged

3

This is taken from the MySQL documentation: Changes in MySQL 5.7.1 (2013-04-23, Milestone 11) ... If a column is declared as NOT NULL, it is not permitted to insert NULL into the column or update it to NULL. However, this constraint was enforced even if there was a BEFORE INSERT (or BEFORE UPDATE trigger) that set the column to a non-NULL value. ...


1

Yes. You should also say UNSIGNED: TINYINT UNSIGNED. Range 0..255; 1 byte. Actually, it is such a tiny optimization that I don't bother mentioning it. Think about using the smallest datatypes when you first CREATE the table; it is messier to make the change later. SMALLINT UNSIGNED: 0..65535, 2 bytes MEDIUMINT UNSIGNED: 0..16M, 3 bytes INT UNSIGNED: ...



Only top voted, non community-wiki answers of a minimum length are eligible