Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Given a list of values, returns the first non-NULL value.
COALESCE ( val, [val, [val ...]])
Returns any object type, according to the type of the first non-NULL value in the list. Returns NULL if all values are NULL.
SELECT COALESCE(NULL, NULL, 1, 2, 3);
+-------------------------------+
| COALESCE(NULL, NULL, 1, 2, 3) |
+-------------------------------+
| 1 |
+-------------------------------+