IFNULL() takes two arguments. If the first argument is not NULL, that argument is returned; otherwise, the fun : IFNULL « Function « SQL / MySQL






IFNULL() takes two arguments. If the first argument is not NULL, that argument is returned; otherwise, the fun

     
ction returns  its second argument:
mysql>
mysql> SELECT IFNULL(NULL,'a'), IFNULL(0,'b');
+------------------+---------------+
| IFNULL(NULL,'a') | IFNULL(0,'b') |
+------------------+---------------+
| a                | 0             |
+------------------+---------------+
1 row in set (0.00 sec)

   
    
    
    
    
  








Related examples in the same category

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.SELECT ISNULL(NULL), ISNULL(0), ISNULL(1);
6.The following expression returns expr2 if expr1 is NULL, and expr1 otherwise: