What is ISNULL() in SQL?

The ISNULL() function returns 1 if the expression sent as a parameter is NULL; otherwise, it returns 0.

Figure 1 shows a visual representation of the ISNULL() function.

Figure 1: Visual representation of ISNULL() function

Syntax

ISNULL(exp)

Parameter

The ISNULL() function takes the expression as a parameter.

Return value

The ISNULL() function returns 1 if the expression sent as a parameter is NULL; otherwise, it returns 0.

Example

-- NULL expression
SELECT ISNULL(NULL);
-- not NULL expression
SELECT ISNULL('educative');
SELECT ISNULL(12345);
New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources