Return the initial non-null value from a list.
SELECT COALESCE(NULL, NULL, NULL, ‘W3Schools.com’, NULL, ‘Example.com’); |
The COALESCE() function retrieves the first non-null value from a list of arguments.
COALESCE(val1, val2, …., val_n) |
Parameter |
Description |
val1, val2, val_n |
Required. The values to evaluate |
Works in: |
From MySQL version 4.0 |
Retrieve the initial non-null value from a list.
SELECT COALESCE(NULL, 1, 2, ‘W3Schools.com’); |