Mega Code Archive

 
Categories / MySQL / Data Type
 

If you add an invalid value to ENUM columns, an empty string () is inserted instead

mysql> mysql> CREATE TABLE test6(bool ENUM("true","false")); Query OK, 0 rows affected (0.00 sec) mysql> mysql> INSERT INTO test6(bool) VALUES ('true'); Query OK, 1 row affected (0.00 sec) mysql> mysql> INSERT INTO test6(bool) VALUES ('troo'); Query OK, 1 row affected, 1 warning (0.00 sec) mysql> mysql> SELECT bool from test6; +------+ | bool | +------+ | true | |      | +------+ 2 rows in set (0.00 sec) mysql> mysql> drop table test6; Query OK, 0 rows affected (0.00 sec) mysql> mysql>