Google News
logo
MySQL - Interview Questions
What is the difference between the NVL function, IFNULL function, and the ISNULL function?
The NVL function, IFNULL function, and the ISNULL function all of them are used to replace the NULL value with another value. The ORACLE users use the NVL function, MySQL users use the IFNULL function and the SQL servers use the ISNULL function
 
For example, let us say we have a column(column_3) which has NULL values.
 
So, if you run the below statement, the output you would get is a NULL value.
 
SELECT column_1 * (column_2 + column_3) FROM Example_Table

Now, to overcome this, you can use the above three functions as follows :
 
SELECT column_1 * (column_2 + NVL(column_3,0)) FROM Example_Table
SELECT column_1 * (column_2 + IFNULL(column_3,0)) FROM Example_Table
SELECT column_1 * (column_2 + ISNULL(column_3,0)) FROM Example_Table
Advertisement