Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

sql
mysql
isnull
communitycreator

What is ISNULL() in SQL?

Harris Amjad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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);

RELATED TAGS

sql
mysql
isnull
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring