ISNULL( )

Use this MySQL function to determine whether the value of the argument given in parentheses is NULL. It returns 1 if the value is NULL and 0 if it is not NULL.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

ISNULL(column)

Explanation

Use this MySQL function to determine whether the value of the argument given in parentheses is NULL. It returns 1 if the value is NULL and 0 if it is not NULL.

Examples

SELECT CONCAT(name_first, SPACE(1), name_last) AS Client,
telephone_work AS 'Work Telephone'
FROM clients
WHERE ISNULL(telephone_home);

In this example, after realizing that there table in MySQL doesn't have home telephone numbers for several of clients, we use the ISNULL( ) function in the WHERE clause of the MySQL statement, SELECT to list client names and their work telephone numbers so that we can call them to get their home telephone numbers. Only rows in which the home_telephone column is NULL will result in a value of 1 and therefore will be shown in the results.