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, 899🔥, 0💬
Popular Posts:
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...
What is dba.FYIcenter.com Website about? dba.FYIcenter.com is a Website for DBAs (database administr...
How To Connect to a MySQL Server with a Port Number in MySQL? If you want to connect a MySQL server ...
How To Replace Given Values with NULL using NULLIF() in SQL Server Transact-SQL? Sometime you want t...
How To Use GO Command in "sqlcmd" in SQL Server? "sqlcmd" is a command line client application to ru...