Google News
logo
MySQL - Interview Questions
How can you test for NULL values in a database?
A NULL value is a field with no value present in that particular field. Since the NULL value cannot be compared to any other NULL values, you cannot use the comparison operators such as =, <, or <>. To compare the fields with NULL values, you have to use the IS NULL and IS NOT NULL operator.
 
Refer below for Syntax of IS NULL and IS NOT NULL.
SELECT column_names FROM table_name WHERE column_name IS NULL;
SELECT column_names FROM table_name WHERE column_name IS NOT NULL;

 

Advertisement