Mysql IS NOT NULL
From w3cyberlearnings
Contents |
MySQL IS NOT NULL Function
This function tests whether an expr is not NULL.
Syntax IS NOT NULL
expr to be tested whether it is not NULL.
expr IS NOT NULL
Example 1
mysql> SELECT 1 IS NOT NULL; +---------------+ | 1 IS NOT NULL | +---------------+ | 1 | +---------------+ 1 row in set (0.00 sec)
Example 2
mysql> SELECT NULL IS NOT NULL; +------------------+ | NULL IS NOT NULL | +------------------+ | 0 | +------------------+ 1 row in set (0.00 sec)
Example 3
mysql> SELECT * FROM myclient; +----+-------+------+---------------------------+ | id | name | age | email | +----+-------+------+---------------------------+ | 1 | Bob | 53 | [email protected] | | 2 | John | 53 | [email protected] | | 3 | Mark | 30 | [email protected] | | 4 | Janny | 40 | [email protected] | | 5 | Johma | 29 | NULL | +----+-------+------+---------------------------+ 5 rows in set (0.00 sec) mysql> SELECT * FROM myclient -> WHERE email IS NOT NULL; +----+-------+------+---------------------------+ | id | name | age | email | +----+-------+------+---------------------------+ | 1 | Bob | 53 | [email protected] | | 2 | John | 53 | [email protected] | | 3 | Mark | 30 | [email protected] | | 4 | Janny | 40 | [email protected] | +----+-------+------+---------------------------+ 4 rows in set (0.00 sec)
Related Links
- IS NOT NULL
- ISNULL
- LEAST
- LIKE
- NOT BETWEEN ... AND ...
- !=, <>