Skip to content
Related Articles

Related Articles

MySQL | ISNULL( ) Function
  • Difficulty Level : Basic
  • Last Updated : 19 Nov, 2019

The MySQL ISNULL() function is used for checking whether an expression is NULL or not. This function returns 1 if the expression passed is NULL, else it returns 0.

The ISNULL() function accepts the expression as a parameter and returns an integer a value 0 or 1 depending on the parameter passed.

Syntax:

ISNULL(expression)

Parameters Used:

expression – It is used to specify the expression.



Return Value:
The MySQL ISNULL() function returns 1 if the expression passed is a NULL expression, else it returns 0.

Supported Versions of MySQL:

  • MySQL 5.7
  • MySQL 5.6
  • MySQL 5.5
  • MySQL 5.1
  • MySQL 5.0
  • MySQL 4.1
  • MySQL 4.0
  • MySQL 3.23

Example-1: Implementing ISNULL() function.

SELECT ISNULL(NULL); 

Output:

1 

Example-2: Implementing ISNULL() function on a string.

SELECT ISNULL("gfg"); 

Output:

0 

Example-3: Implementing ISNULL() function on an integer value.

SELECT ISNULL(123); 

Output:

0 
My Personal Notes arrow_drop_up
Recommended Articles
Page :