Syntax
COALESCE(expr, expr, expr,...)
Purpose
COALESCE() evaluates a specified series of expressions in order. It returns the first non-NULL value and stops evaluating the rest expressions. If all expressions are NULL, it returns NULL.
All expressions must be of the same type or can be implicitly converted to the same type.
Examples
obclient> SELECT COALESCE(NULL,NULL,3,4,5), COALESCE(NULL,NULL,NULL);
+---------------------------+--------------------------+
| COALESCE(NULL,NULL,3,4,5) | COALESCE(NULL,NULL,NULL) |
+---------------------------+--------------------------+
| 3 | NULL |
+---------------------------+--------------------------+
1 row in set