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, 918🔥, 0💬
Popular Posts:
What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema in Oracle? For a us...
What is test testing area for? The testing area is provided to allow visitors to post testing commen...
How To Provide Default Values to Function Parameters in SQL Server Transact-SQL? If you add a parame...
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...
Collections: Interview Questions MySQL Tutorials MySQL Functions Oracle Tutorials SQL Server Tutoria...