Tsallaka zuwa abun ciki
Justice Tech School

NULL Values

NULL means a value is missing or unknown. You cannot test it with =. Use IS NULL and IS NOT NULL. Any arithmetic or comparison with NULL gives NULL, and aggregate functions such as AVG ignore NULLs.

Example
SELECT name, score
FROM students
WHERE score IS NULL;

Result

name | score
Esi  | NULL
Example
SELECT name
FROM students
WHERE score IS NOT NULL
ORDER BY name
LIMIT 3;

Result

name
Ada
Amina
Kofi

Exercise

Find rows with no score.

SELECT * FROM students WHERE score  NULL;

Quiz Test

How do you test for NULL?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.