Returns value if expr is NULL. If expr is not NULL, IFNULL returns expr.
Syntax
IFNULL( expr, value)
Notes
The data type of value must be compatible with the data type of expr.
Example
In this example, which illustrates the IFNULL function, the SELECT statement returns three rows with a NULL value in column C1, and two non-NULL values:
SELECT C1, IFNULL(C1, 9999) FROM TEMP ORDER BY C1;
C1 IFNULL(C1,9999)
-- ----------------
9999
9999
9999
1 1
3 3