COALESCE() and ISNULL() Functions : COALESCE « Function « SQL / MySQL






COALESCE() and ISNULL() Functions

     
mysql>
The COALESCE() function returns the first value in the list of arguments that is not NULL.
If all values are NULL, then NULL is returned.
mysql>
COALESCE(<value> [{, <value>}...])
mysql>
mysql> SELECT COALESCE(NULL, 2, NULL, 3);
+----------------------------+
| COALESCE(NULL, 2, NULL, 3) |
+----------------------------+
|                          2 |
+----------------------------+
1 row in set (0.00 sec)

mysql>

   
    
    
    
    
  








Related examples in the same category

1.Using COALESCE function
2.If the league number is null, give the value 1.