Jump to: navigation, search

Mysql IS NOT

From w3cyberlearnings

Contents

MySQL IS NOT Function

This function tests an expr against a boolean value, where boolean_value can be TRUE, FALSE, or UNKNOWN.

Syntax IS NOT

expr to be tested against a boolean value.

expr IS NOT boolean_value

Example 1

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

mysql> SELECT 3 IS NOT FALSE;
+----------------+
| 3 IS NOT FALSE |
+----------------+
|              1 |
+----------------+
1 row in set (0.00 sec)

mysql> SELECT 3 IS NOT TRUE;
+---------------+
| 3 IS NOT TRUE |
+---------------+
|             0 |
+---------------+
1 row in set (0.00 sec)

Example 2

mysql> SELECT * FROM myclient;
+----+-------+------+---------------------------+
| id | name  | age  | email                     |
+----+-------+------+---------------------------+
|  1 | Bob   |   53 | [email protected]         |
|  2 | John  |   53 | [email protected]            |
|  3 | Mark  | NULL | [email protected] |
|  4 | Janny |   40 | [email protected]           |
|  5 | Johma |   29 | NULL                      |
+----+-------+------+---------------------------+
5 rows in set (0.00 sec)

mysql> SELECT * FROM myclient
    -> WHERE age IS NOT UNKNOWN;
+----+-------+------+-------------------+
| id | name  | age  | email             |
+----+-------+------+-------------------+
|  1 | Bob   |   53 | [email protected] |
|  2 | John  |   53 | [email protected]    |
|  4 | Janny |   40 | [email protected]   |
|  5 | Johma |   29 | NULL              |
+----+-------+------+-------------------+
4 rows in set (0.00 sec)

Related Links



Navigation
Web
SQL
MISC
References