Mysql IS NULL
From w3cyberlearnings
Contents |
MySQL IS NULL Function
This functions tests a value for NULL. It returns 1 when it is NULL, and otherwise it returns 0.
Syntax IS NULL
expr to test whether it is NULL.
IS NULL(expr);
Example 1
mysql> SELECT NULL IS NULL; +--------------+ | NULL IS NULL | +--------------+ | 1 | +--------------+ 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 NULL; +----+------+------+---------------------------+ | id | name | age | email | +----+------+------+---------------------------+ | 3 | Mark | NULL | [email protected] | +----+------+------+---------------------------+ 1 row in set (0.00 sec)