Collections:
COALESCE() - Finding First Non-NULL Value
How to find the first non-NULL value from a list using the COALESCE() function?
✍: FYIcenter.com
COALESCE(val1, val2, ...) is a MySQL built-in function that
returns the first non-NULL value from a given list of values.
For example:
SELECT COALESCE(NULL, 'FYI', NULL, 3.14); -- +-----------------------------------+ -- | COALESCE(NULL, 'FYI', NULL, 3.14) | -- +-----------------------------------+ -- | FYI | -- +-----------------------------------+
Reference information of the COALESCE() function:
COALESCE(val1, val2, ...): val Returns the first non-NULL value from a given list of values. Arguments, return value and availability: val1, val2, ...: One or more values to be examined. val: Return value. The first non-NULL value. Available since MySQL 4.0.
⇒ CONVERT() - Character Set Conversion
⇐ CAST() - Casting Expression to Value
2026-03-22, 1535🔥, 0💬
Popular Posts:
How To Install Oracle Database 10g XE in Oracle? To install 10g universal edition, double click, Ora...
What Happens to an Arithmetic Operation with Two Different Data Types in SQL Server Transact-SQL? Wh...
What Are the Differences between DATE and TIMESTAMP in Oracle? The main differences between DATE and...
How To Convert Character Strings into Numeric Values in SQL Server Transact-SQL? Sometimes you need ...
How to detect the collation coercibility associated to a given character string using the COERCIBILI...