Mega Code Archive

 
Categories / MySQL / Function
 

COALESCE() and ISNULL() Functions

mysql> The COALESCE() function returns the first value in the list of arguments that is not NULL. If all values are NULL, then NULL is returned. mysql> COALESCE(<value> [{, <value>}...]) mysql> mysql> SELECT COALESCE(NULL, 2, NULL, 3); +----------------------------+ | COALESCE(NULL, 2, NULL, 3) | +----------------------------+ |                          2 | +----------------------------+ 1 row in set (0.00 sec) mysql>