IS NULL
FunctionSELECT salary, ISNULL(salary) AS nullVal FROM employee;
0
if the salary is not null and 1
if it is null.SELECT SUM(ISNULL(salary, 10000)) AS Sal_sum FROM employee;
salary
is null, adds 10000
for summation purposes.COALESCE
FunctionSELECT ID, salary, COALESCE(salary, ID) AS result FROM employee;
salary
is not null, it returns salary
; otherwise, it returns ID
.NULLIF
FunctionSELECT ID, first_name, NULLIF(ID, new_ID) AS result FROM employee;
ID
equals new_ID
, returns null; otherwise, returns ID
.IFNULL
FunctionSELECT ID, salary, IFNULL(salary, 999) AS result FROM employee;
salary
if not null; if null, replaces with 999
.