0
0
MySQLquery~5 mins

IS NULL and IS NOT NULL in MySQL - 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 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?
AIS NOT NULL
B= NULL
CIS NULL
D<> NULL
What does IS NOT NULL do in a SQL query?
AFinds rows where the column is missing
BFinds rows where the column has a value
CDeletes rows with NULL
DUpdates NULL values
Why can't you use WHERE column = NULL to find NULL values?
ABecause NULL is a string
BBecause = NULL is the same as IS NULL
CBecause NULL is zero
DBecause NULL means unknown and = NULL always returns false
Which query finds all customers with a known email address?
ASELECT * FROM customers WHERE email IS NOT NULL;
BSELECT * FROM customers WHERE email IS NULL;
CSELECT * FROM customers WHERE email = NULL;
DSELECT * FROM customers WHERE email <> NULL;
If you want to find rows where a column is not missing, which condition do you use?
AIS NOT NULL
BIS NULL
C= NULL
D!= NULL
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.