MySQL | ISNULL( ) Function

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


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.