COALESCE
Descriptionβ
Returns the first non-null expression from left to right in the parameter list. If all arguments are NULL, returns NULL.
Syntaxβ
COALESCE(<expr> [, ...])
Parametersβ
Parameter | Description |
---|---|
<expr> | A sequence of expressions to evaluate. All expressions must be compatible data types. |
Return Valueβ
The first non-null expression in the parameter list. Returns NULL if all arguments are NULL.
Examplesβ
SELECT COALESCE(NULL, '1111', '0000');
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+