Home
SQL / MySQL
Aggregate Functions
Backup Load
Command MySQL
Cursor
Data Type
Database
Date Time
Engine
Event
Flow Control
FullText Search
Function
Geometric
I18N
Insert Delete Update
Join
Key
Math
Procedure Function
Regular Expression
Select Clause
String
Table Index
Transaction
Trigger
User Permission
View
Where Clause
XML
IFNULL « Function « SQL / MySQL
SQL / MySQL
Function
IFNULL
1.
The IFNULL() function returns a value based on whether a specified expression evaluates to NULL.
2.
IFNULL() tests its first argument and returns it if it's not NULL, or returns its second argument otherwise
3.
IF( ) and IFNULL( ) are useful for catching divide-by-zero operations
4.
Use IFNULL( ) to map their results appropriately:
5.
IFNULL() takes two arguments. If the first argument is not NULL, that argument is returned; otherwise, the fun
6.
SELECT ISNULL(NULL), ISNULL(0), ISNULL(1);
7.
The following expression returns expr2 if expr1 is NULL, and expr1 otherwise: