Aggregate Functions
The COALESCE
function returns the first NOT-NULL
value in a list.
Syntax
SELECT COALESCE(<list>);
or
SELECT COALESCE(<column>, <null-value-replacement>)
FROM <table>;
Example #1
SELECT COALESCE(null, null, 1);
Coalesce |
---|
1 |
Example #2
SELECT COALESCE(name, 'name not provided')
FROM Company;
Name |
---|
Walmart |
Disney |
PayPal |
Blackberry |