0
0
SQLquery~5 mins

WHERE with IS NULL and IS NOT NULL in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the SQL condition IS NULL check for?
It checks if a column's value is missing, meaning it has no data stored (NULL).
Click to reveal answer
beginner
How do you select rows where a column is NOT empty in SQL?
Use WHERE column_name IS NOT NULL to find rows where the column has some value.
Click to reveal answer
intermediate
Why can't you use = NULL to check for NULL values in SQL?
Because NULL means unknown or missing data, and = compares values. Use IS NULL instead.
Click to reveal answer
beginner
Write a SQL query to find all employees without a manager (manager_id is NULL).
SELECT * FROM employees WHERE manager_id IS NULL;
Click to reveal answer
beginner
What is the difference between IS NULL and IS NOT NULL in a WHERE clause?
IS NULL finds rows where the column has no value. IS NOT NULL finds rows where the column has some value.
Click to reveal answer
Which SQL clause correctly finds rows where the 'email' column has no value?
AWHERE email IS NOT NULL
BWHERE email = NULL
CWHERE email = ''
DWHERE email IS NULL
What does WHERE phone_number IS NOT NULL do?
AFinds rows where phone_number is missing
BFinds rows where phone_number has a value
CFinds rows where phone_number equals zero
DFinds rows where phone_number is empty string
Why is WHERE column = NULL not correct in SQL?
ABecause NULL means unknown and can't be compared with =
BBecause NULL is a reserved keyword
CBecause = only works with numbers
DBecause NULL is a string
Which query finds all records where 'birthdate' is known (not missing)?
ASELECT * FROM table WHERE birthdate IS NOT NULL
BSELECT * FROM table WHERE birthdate = NULL
CSELECT * FROM table WHERE birthdate IS NULL
DSELECT * FROM table WHERE birthdate = ''
If you want to find rows where a column 'score' is missing, which is correct?
AWHERE score = ''
BWHERE score = 0
CWHERE score IS NULL
DWHERE score IS NOT NULL
Explain how to use IS NULL and IS NOT NULL in a SQL WHERE clause and why they are important.
Think about how databases store missing information.
You got /4 concepts.
    Write a simple SQL query to find all records where the 'address' field is missing.
    Use IS NULL to check for missing data.
    You got /3 concepts.