Find the NULL Comparison Mistake
Find the Mistake Medium
Question
This query has a logical error. Find and fix it:
Code
SELECT * FROM users WHERE email = NULL;
Hint
You cannot use = to compare with NULL.
Explanation
You cannot use = NULL to check for NULL — the result is always NULL (unknown), not true. Fix: use WHERE email IS NULL to find rows where email is NULL, or WHERE email IS NOT NULL to find non-NULL rows.
Related Resources
Related Lessons
- WHERE Clause
Learn NULL handling.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.