# What is the use of MySQL IS and IS NOT operator?

MySQLMySQLi Database

#### MySQL Database Training for Beginners

39 Lectures 5.5 hours

#### Python programming with MySQL database: from Scratch

152 Lectures 16 hours

#### Learn MySQL from scratch for Data Science and Analytics

87 Lectures 5.5 hours

In MySQL, both IS and IS NOT operators are used to test a value against a Boolean value.

The syntax of IS operator can be as follows −

Val IS Boolean_val

Here Val is the value that we want to test against Boolean value.

Boolean_val is the Boolean value against which the value would be tested and it can be TRUE, FALSE or UNKNOWN.

The syntax of IS NOT operator can be as follows −

Val IS NOT Boolean_val

Here Val is the value that we want to test against Boolean value.

Boolean_vais the Boolean value against which the val would be tested and it can be TRUE, FALSE or UNKNOWN.

Following MySQL statements will demonstrate the above −

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> Select 1 IS NOT TRUE, 0 IS NOT FALSE, NULL IS NOT UNKNOWN;
+---------------+----------------+---------------------+
| 1 IS NOT TRUE | 0 IS NOT FALSE | NULL IS NOT UNKNOWN |
+---------------+----------------+---------------------+
|             0 |              0 |                   0 |
+---------------+----------------+---------------------+
1 row in set (0.00 sec)

mysql> Select 0 IS NOT TRUE, 1 IS NOT FALSE, NULL IS NOT UNKNOWN;
+---------------+----------------+---------------------+
| 0 IS NOT TRUE | 1 IS NOT FALSE | NULL IS NOT UNKNOWN |
+---------------+----------------+---------------------+
|             1 |              1 |                   0 |
+---------------+----------------+---------------------+
1 row in set (0.00 sec)
Updated on 22-Jun-2020 06:41:52