IFNULL
IFNULL function returns the first not NULL input expression.
Syntax
IFNULL(expression1, expression2)
Description
Returns the first not NULL input expression.
-
Returns expression1 if expression1 is not NULL.
-
Returns expression2 if expression1 is NULL.
-
Returns NULL if both input expressions are NULL.
Example
-
IFNULL(‘diff’, ‘same’)
This example returns diff
-
IFNULL(NULL, ‘same’)
This example returns same.
-
IFNULL(NULL, NULL)
This example returns NULL