COALESCE
Checks from left to right for the first non-NULL argument found for each entry parameter pair.
Syntax
COALESCE(<expression> [,...])
Parameters
Parameter | Description | Supported input types |
---|---|---|
<expression> | The expression(s) to coalesce. | Any |
Return Types
Same as input type
Example
The following example returns the first non-NULL value provided, which is the username esimpson
:
SELECT COALESCE(NULL, 'esimpson','sabrina21') AS nicknames;
Returns: esimpson