The empty values are represented as NULLS in a table. 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. A NULL value is different from ZERO. NULL values cannot be tested using <,>,= etc operators. It is tested using IS NULL() & IF NULL() functions.
Example:
select * from students
where Section IS NULL;

select * from students
where Section IS NOT NULL;

Inserting values in the column having a null value.
Syntax:
SELECT IFNULL(column name, value)
From table name;
EXAMPLE:
select Name, IFNULL(Section , 'B')
from students;

Leave a comment