MySQL Tutorial/Comparison Functions Operators/IS

Материал из SQL эксперт
Перейти к: навигация, поиск

IS "boolean_value": Tests a value against a boolean value, where boolean_value can be TRUE, FALSE, or UNKNOWN

mysql>
mysql> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;
+-----------+------------+-----------------+
| 1 IS TRUE | 0 IS FALSE | NULL IS UNKNOWN |
+-----------+------------+-----------------+
|         1 |          1 |               1 |
+-----------+------------+-----------------+
1 row in set (0.00 sec)
mysql>


IS NOT "boolean_value": Tests a value against a boolean value, where boolean_value can be TRUE, FALSE, or UNKNOWN

mysql>
mysql> SELECT 1 IS NOT UNKNOWN, 0 IS NOT UNKNOWN, NULL IS NOT UNKNOWN;
+------------------+------------------+---------------------+
| 1 IS NOT UNKNOWN | 0 IS NOT UNKNOWN | NULL IS NOT UNKNOWN |
+------------------+------------------+---------------------+
|                1 |                1 |                   0 |
+------------------+------------------+---------------------+
1 row in set (0.00 sec)
mysql>