Boolean test conditions are used to check whether the logical value of an expression is TRUE, FALSE, or UNKNOWN.
Note
For more information about Boolean test operators, see the IS TRUE and IS FALSE sections in Comparison operators.
Syntax
expr IS [ NOT ] { TRUE | FALSE | UNKNOWN }
Usage instructions
IS TRUE: Returns TRUE if the expression is TRUE, and FALSE otherwise.IS FALSE: Returns TRUE if the expression is FALSE; otherwise, returns FALSE.IS UNKNOWN: Returns TRUE if the expression is UNKNOWN, and FALSE otherwise.IS NOT TRUE,IS NOT FALSE, andIS NOT UNKNOWNare the negations of the corresponding conditions.
Examples
obclient> SELECT 1 IS TRUE AS result;
+--------+
| result |
+--------+
| 1 |
+--------+
1 row in set
obclient> SELECT 0 IS FALSE AS result;
+--------+
| result |
+--------+
| 1 |
+--------+
1 row in set
obclient> SELECT NULL IS UNKNOWN AS result;
+--------+
| result |
+--------+
| 1 |
+--------+
1 row in set
