How To Use NULL Functions In SQL

In this article, we will learn how to use the NULL Functions in SQL.

The following are the commonly used SQL NULL Functions.

Function Description
ISNULL() It returns the specified value IF the expression is NULL, otherwise returns the expression.

SELECT ISNULL(EmpName, '-') AS EmpName FROM tblEmployees;


COALESCE() It returns the first non-null value in a list.

SELECT COALESCE(NULL, NULL, '', NULL, 'thecodehubs');


NULLIF() It returns NULL if two expressions are equal otherwise, it returns the first expression.

SELECT NULLIF('thecodehubs', 'thecodehubs');

Output: NULL


Also, check How To Use Aggregate Functions In SQL

Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories