You are viewing an older version of this section. View current production version.
Join the SingleStore Community Today
Get expert advice, develop skills, and connect with others.


Given a list of values, returns the first non-NULL value.


COALESCE ( val, [val, [val ...]])


  • val: any object

Return Type

Returns any object type, according to the type of the first non-NULL value in the list. Returns NULL if all values are NULL.


memsql> select coalesce(NULL, NULL, 1, 2, 3);
| coalesce(NULL, NULL, 1, 2, 3) |
|                             1 |