ID EN
Comparison Functions and Operators

ISNULL(expr)

MySQL 8.4

If expr is NULL, ISNULL() returns 1, otherwise it returns 0.

Syntax

MYSQL
SELECT ISNULL(1+1);
0
SELECT ISNULL(1/0);
1

Examples

Example

ISNULL() can be used instead of = to test whether a value is NULL. (Comparing a value to NULL using = always yields NULL.)

MYSQL
SELECT ISNULL(1+1);
0
SELECT ISNULL(1/0);
1