Skip to content

IFNULL

IFNULL(expression, replace_with_expression)

Section titled “IFNULL(expression, replace_with_expression)”
  • expression: This is the first parameter of `IFNULL` function. It’s an expression that will be evaluated and returned if its value is NOT NULL.
  • replace_with_expression: This is the second parameter of the `IFNULL` function. If the initial expression evaluates to NULL, then this is the value or expression that will be returned instead.
SELECT IFNULL(NULL, 'This is not null');
'This is not null'

The IFNULL function replaces NULL values with the specified replacement value. In this case, NULL is replaced with the string 'This is not null'.