COALESCE()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the first non-NULL value in the given list and NULL when all values are NULL.
USAGE
COALESCE(value[, value] ...)
Argument Name | Description |
---|---|
| One or more values to check |
DETAILS
COALESCE()
is a comparison function that returns the first non-NULL
value in the argument list.
A NULL
is returned if no non-NULL
arguments are provided.
EXAMPLES
SELECT COALESCE(NULL, NULL, 'foo', NULL, 'bar');
+------------------------------------------+
| COALESCE(NULL, NULL, 'foo', NULL, 'bar') |
+------------------------------------------+
| foo |
+------------------------------------------+