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)
returned1
, because the parameter isNULL
.ISNULL('A')
returned0
, because the parameterA
is notNULL
.ISNULL(1 / 2)
returned0
, because the result of1 / 2
is notNULL
.ISNULL(1 / 0)
returned1
, because the result of1 / 0
isNULL
.
Conclusion
In MariaDB, ISNULL()
is a built-in function that returns 1
if the gaven parameter is NULL
, otherwise returns 0
.