Skip to main content

IS NULL (IS NOT NULL) Operators

NULL values were discussed in Outcome 1. Just to remind you:

In SQL, the data in a column can hold a special value known as NULL. This must not be confused with spaces or zero. It means that this column has no value assigned, ie it is unknown.

In order to check whether a value in a column has a null value the IS NULL clause is used in the WHERE statement. For example, to select all students whose date of births have not yet been entered, an SQL SELECT command could be:

SELECT title, forename, surname

FROM student

WHERE date_of_birth IS NULL;

Conversely, if you wish to select all students whose dates of births have been entered, then the IS NOT NULL clause is used, e.g.:

SELECT forename, surname

FROM student

WHERE date_of_birth IS NOT NULL;

Next: Activity 2.3A