IFNULL
Accepts exactly two arguments and returns the first non NULL argument, can be used to substitute a default value for a NULL value.
The
IFNULLfunction is equivalent to theCOALESCEfunction with two arguments only, theCOALESCEfunction can have more than two arguments.
See also:
[SELECT] [COALESCE] [NULLIF]
Syntax
SELECT IFNULL(expression1, expression2) FROM <multipartIdentifier>;
Arguments
expression
Two expressions of any data type which resolve to a NULL or non NULL value.
If both expression arguments are
NULL, theIFNULLfunction returnsNULL.
Return Value(s)
Returns the first non NULL value from the two expression arguments.
Examples
Replace a NULL value with a default value
SELECT name, ifnull(website, 'Not hosting a website') AS website
FROM google.storage.buckets where project = 'stackql';
For more information, see https://www.sqlite.org/lang_corefunc.html#ifnull