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
2023-12-19, 989🔥, 0💬
Popular Posts:
How To Use SQL*Plus Built-in Timers in Oracle? If you don't have a stopwatch/timer and want to measu...
What are single-byte character string data types supported in SQL Server Transact-SQL? Single-byte c...
What Is an Oracle Tablespace in Oracle? An Oracle tablespace is a big unit of logical storage in an ...
How To Assign Debug Privileges to a User in Oracle? In order to run SQL Developer in debug mode, the...
How To Convert Numeric Values to Character Strings in MySQL? You can convert numeric values to chara...