Recall & Review
beginner
What does the SQL condition
IS NULL check for?It checks if a column's value is missing or unknown, meaning it has no value stored (NULL).
Click to reveal answer
beginner
How do you find rows where a column has any value (not NULL)?
Use
IS NOT NULL to select rows where the column has a value stored (not missing).Click to reveal answer
intermediate
Why can't you use
= NULL to check for NULL values?Because NULL means unknown, and comparing with
= doesn't work. You must use IS NULL or IS NOT NULL.Click to reveal answer
beginner
Write a simple SQL query to find all employees without a phone number (phone_number is NULL).
SELECT * FROM employees WHERE phone_number IS NULL;
Click to reveal answer
beginner
What is the difference between
IS NULL and IS NOT NULL?IS NULL finds rows where the value is missing (NULL). IS NOT NULL finds rows where the value exists (not NULL).Click to reveal answer
Which SQL condition correctly finds rows where a column is missing a value?
✗ Incorrect
Use IS NULL to check for missing (NULL) values. = NULL does not work.
What does
IS NOT NULL do in a SQL query?✗ Incorrect
IS NOT NULL selects rows where the column has any value (not NULL).
Why can't you use
WHERE column = NULL to find NULL values?✗ Incorrect
NULL means unknown, so = NULL does not work. Use IS NULL instead.
Which query finds all customers with a known email address?
✗ Incorrect
IS NOT NULL finds rows where email has a value.
If you want to find rows where a column is not missing, which condition do you use?
✗ Incorrect
IS NOT NULL finds rows where the column has a value.
Explain how to check for missing values in a SQL column and why you use that method.
Think about how SQL treats unknown values.
You got /4 concepts.
Describe the difference between IS NULL and IS NOT NULL in SQL queries.
One finds missing data, the other finds present data.
You got /4 concepts.