MariaDB ISNULL() Function

In MariaDB, ISNULL() is a built-in function that returns 1 if the gaven parameter is NULL, otherwise returns 0.

MariaDB ISNULL() Syntax

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

ISNULL(expr)

Parameters

expr

Optional. Determines whether this expression is NULL.

Return value

The MariaDB ISNULL() function returns 1 if expr is NULL, otherwise 0.

MariaDB ISNULL() Examples

This statement shows the usage of the MariaDB ISNULL() function:

SELECT
  ISNULL(NULL),
  ISNULL('A'),
  ISNULL(1 / 2),
  ISNULL(1 / 0);

Output:

+--------------+-------------+---------------+---------------+
| ISNULL(NULL) | ISNULL('A') | ISNULL(1 / 2) | ISNULL(1 / 0) |
+--------------+-------------+---------------+---------------+
|            1 |           0 |             0 |             1 |
+--------------+-------------+---------------+---------------+

In this example:

  • ISNULL(NULL) returned 1, because the parameter is NULL.
  • ISNULL('A') returned 0, because the parameter A is not NULL.
  • ISNULL(1 / 2) returned 0, because the result of 1 / 2 is not NULL.
  • ISNULL(1 / 0) returned 1, because the result of 1 / 0 is NULL.

Conclusion

In MariaDB, ISNULL() is a built-in function that returns 1 if the gaven parameter is NULL, otherwise returns 0.