In this blog, we will see what NULL value in SQL is and how to check it.
If a field in a table is optional and we insert a new record or update it without adding a value to this field, then
the field will be saved with a NULL value.
Note
It is very important to understand that a Null value is very difference from 0,' '. A field in a table with a NULL value means that the insert or update a record command left it blank .
Test for NULL Values?
We can't test for NULL values with comparison operators, such as =, <, or <>. For testing it, we have to use the IS NULL and IS NOT NULL operators.
IS NULL Syntax
- SELECT *From student WHERE Name IS NULL
Record is not available.
IS NOT NULL Syntax
- SELECT *From student WHERE Name IS NOT NULL
Record is available.
Note
Use "IS NULL" to look for NULL values.