MySQL ISNULL() Function

In MySQL, the ISNULL() function checks whether the specified parameter is NULL.

ISNULL() Syntax

Here is the syntax of the MySQL ISNULL() function:

ISNULL(expr)

Parameters

expr
Required. An expression to be tested.

Return value

MySQL ISNULL() function checks if the specified parameter is NULL. If the argument is NULL, the function returns 1, otherwise returns 0.

If you do not provide parameters for ISNULL(), MySQL will return an error.

ISNULL() Examples

Here is a example of ISNULL().

SELECT
    ISNULL(NULL),
    ISNULL(""),
    ISNULL("A"),
    ISNULL(0),
    ISNULL(1);
+--------------+------------+-------------+-----------+-----------+
| ISNULL(NULL) | ISNULL("") | ISNULL("A") | ISNULL(0) | ISNULL(1) |
+--------------+------------+-------------+-----------+-----------+
|            1 |          0 |           0 |         0 |         0 |
+--------------+------------+-------------+-----------+-----------+

Here, only ISNULL(NULL) returned 1, the others returned 0.