Perform queries on enumerated fields based on their indexes
mysql>
mysql> CREATE TABLE test6(bool ENUM("true","false"));
Query OK, 0 rows affected (0.01 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 * FROM test6 WHERE bool=0;
+------+
| bool |
+------+
| |
+------+
1 row in set (0.00 sec)
mysql>
mysql> SELECT * FROM test6 WHERE bool=1;
+------+
| bool |
+------+
| true |
+------+
1 row in set (0.00 sec)
mysql>
mysql> INSERT INTO test6(bool) VALUES(2);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> SELECT * FROM test6;
+-------+
| bool |
+-------+
| true |
| |
| false |
+-------+
3 rows in set (0.00 sec)
mysql>
mysql> drop table test6;
Query OK, 0 rows affected (0.00 sec)
Related examples in the same category