IS

Description

The IS tests a value against a boolean value, where boolean_value can be TRUE, FALSE, or UNKNOWN.

Syntax

1. > IS boolean_value

Examples

1. mysql> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;
2. +----------+-----------+---------+
3. | 1 = true | 0 = false | null =  |
4. +----------+-----------+---------+
5. | true     | true      | NULL    |
6. +----------+-----------+---------+
7. 1 row in set (0.01 sec)
1. create table t1 (a boolean,b bool);
2. insert into t1 values (0,1),(true,false),(true,1),(0,false),(NULL,NULL);

4. mysql> select * from t1;
5. +-------+-------+
6. | a     | b     |
7. +-------+-------+
8. | false | true  |
9. | true  | false |
10. | true  | true  |
11. | false | false |
12. | NULL  | NULL  |
13. +-------+-------+
14. mysql> select * from t1 where a<=b and a is not NULL;
15. +-------+-------+
16. | a     | b     |
17. +-------+-------+
18. | false | true  |
19. | true  | true  |
20. | false | false |
21. +-------+-------+
22. 3 rows in set (0.01 sec)