IF(expr1 , expr2 , expr3)
The value of expr1 is TRUE, the return value is expr2
The value of expr1 is FALSE, the return value is expr3
SELECT IF (1 >= 2, 'xx', 'yy') -- yy
IFNULL(expr1 , expr2)
If the value of expr1 is NULL, return expr2
If the value of expr1 is not NULL, return expr1
SELECT IFNULL(NULL,'yy') -- yy SELECT IFNULL('xx','yy') -- xx