Mega Code Archive

 
Categories / MySQL / Function
 

The IFNULL() function returns a value based on whether a specified expression evaluates to NULL

mysql> IFNULL(<expression1>, <expression2>) mysql> The function returns <expression1> if it is not NULL; otherwise, it returns <expression2>. mysql> mysql> SELECT IFNULL(10*NULL, 'expression incorrect'); +-----------------------------------------+ | IFNULL(10*NULL, 'expression incorrect') | +-----------------------------------------+ | expression incorrect                    | +-----------------------------------------+ 1 row in set (0.00 sec) mysql>