Collections:
IFNULL() - Replacing NULL Value
How to substitute a NULL value with a replacement value using the IFNULL() function?
✍: FYIcenter.com
IFNULL(val1, val2) is a MySQL built-in function that
returns the second argument if the first argument is NULL, the first
argument otherwise.
For example:
SELECT IFNULL(NULL, 'replacement'), IFNULL('original', 'replacement');
-- +-----------------------------+-----------------------------------+
-- | IFNULL(NULL, 'replacement') | IFNULL('original', 'replacement') |
-- +-----------------------------+-----------------------------------+
-- | replacement | original |
-- +-----------------------------+-----------------------------------+
Reference information of the IFNULL() function:
IFNULL(val1, val2): val Returns the second argument if the first argument is NULL, the first argument otherwise. Arguments, return value and availability: val1, val2: Required. The values to be selected from. val: Return value. The selected value. Available since MySQL 4.0.
⇒ INET_ATON() - IP Address String to Number
⇐ IF() - Conditional Value Selection
2023-12-19, 1741🔥, 0💬
Popular Posts:
How AdventureWorksLT tables are related in SQL Server? There are 12 user tables defined in Adventure...
How Run SQL*Plus Commands That Are Stored in a Local File in Oracle? If you have a group of commands...
Where to find MySQL database server tutorials? Here is a collection of tutorials, tips and FAQs for ...
How to set the current database in SQL Server? Once you are connected to the SQL Server, you should ...
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions in SQL Server Transact-...