In a database table if a column field has NULL value it means that field has no value.
When a new record in inserted in table and a column is optional and we don’t insert value in that column field then that field will saved with NULL value.
Test for NULL Values :
NULL values can not be test by comparison operators(=,>,<,<>). We can use ‘IS NULL’ and ‘IS NOT NULL’ operators for check the NULL values.
Syntax-
SELECT column1,column2,cloumn3,…. FROM tablename WHERE column IS NULL/ IS NOT NULL;
Lets we have a table 'StudentData'
Syntax- SELECT column1, column2,... FROM table_name WHERE column IS NULL/ IS NOT NULL
Check for IS NULL values :
Here we check the null value in the field in StudentData table.
select stuAge, stuName, stuCourse from StudentData where stuCourse is null;
Check for IS NOT NULL values :
select stuAge, stuName, stuCourse from StudentData where stuCourse is not null;