What is NULL in SQL

A field with a NULL value is a field with no value. If a field in a table is optional, it is possible to insert a new record or update a record without adding a value to this field. Then, the field will be saved with a NULL value.

images/articles/mysql/what-is-null-in-sql.jpg

A NULL value is different from a zero value or a blank space or false value or a field that contains spaces. A null value is the absence of a value. It is not possible to test for NULL values with comparison operators, such as =, <, or <>. You have to use the IS NULL and IS NOT NULL operators instead.

SELECT column_names FROM table_name WHERE column_name IS NULL;

Similarly, you can use IS NOT NULL operator.

SELECT column_names FROM table_name WHERE column_name IS NOT NULL;