COALESCE
Returns the first argument which is not NULL from a series of two or more arguments, can be used to substitute a default value for a NULL value.
The
COALESCEfunction is equivalent to theNVLfunction in Oracle or theIFNULLfunction in MySQL.
See also:
[SELECT] [IFNULL] [NULLIF]
Syntax
SELECT COALESCE(expression1, expression2 [, ..]) FROM <multipartIdentifier>;
Arguments
expression
Two or more expressions of any data type which resolve to a NULL or non NULL value.
If all of the expression arguments are
NULL, theCOALESCEfunction returnsNULL.
Return Value(s)
Returns the first non NULL value from the series of expression arguments.
Examples
Replace a NULL value with a default value
SELECT name, coalesce(website, cors, 'not hosting shared resources') AS website_or_cors_config
FROM google.storage.buckets where project = 'stackql';
For more information, see https://www.sqlite.org/lang_corefunc.html#coalesce