Syntax
COALESCE(expr, expr, expr,...)
Purpose
Evaluates the expressions in sequence and returns the first non-NULL value it encounters. If all expressions are NULL, it returns NULL.
All expressions must be of the same type or implicitly convertible 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
