NULL means unknown or missing value. It is not the same as zero or empty string.
Click to reveal answer
beginner
What is the result of TRUE AND NULL in SQL?
The result is NULL because the unknown value could be TRUE or FALSE, so the whole expression is unknown.
Click to reveal answer
beginner
What is the result of FALSE OR NULL in SQL?
The result is NULL because the unknown value might be TRUE, so the whole expression is unknown.
Click to reveal answer
intermediate
What does NOT NULL evaluate to in SQL?
NOT NULL is still NULL because negation of unknown remains unknown.
Click to reveal answer
intermediate
How does SQL treat NULL in logical expressions compared to TRUE or FALSE?
SQL uses three-valued logic: TRUE, FALSE, and UNKNOWN (NULL). NULL means the truth is unknown, affecting AND, OR, NOT results.
Click to reveal answer
What is the result of TRUE AND NULL in SQL?
ATRUE
BError
CFALSE
DNULL
✗ Incorrect
TRUE AND NULL results in NULL because the unknown value could be TRUE or FALSE.
What is the result of FALSE OR NULL in SQL?
ATRUE
BFALSE
CNULL
DError
✗ Incorrect
FALSE OR NULL results in NULL because the unknown value might be TRUE.
What does NOT NULL evaluate to in SQL?
AFALSE
BNULL
CTRUE
DError
✗ Incorrect
NOT NULL remains NULL because negation of unknown is still unknown.
In SQL, NULL means:
AUnknown or missing value
BEmpty string
CZero
DFalse
✗ Incorrect
NULL represents unknown or missing data, not zero or empty string.
Which logic system does SQL use for NULL values?
AThree-valued logic
BTwo-valued logic
CBoolean logic only
DNo logic
✗ Incorrect
SQL uses three-valued logic: TRUE, FALSE, and UNKNOWN (NULL).
Explain how NULL affects the results of AND, OR, and NOT operations in SQL.
Think about how unknown values change logical outcomes.
You got /5 concepts.
Describe the difference between NULL and FALSE in SQL logical expressions.
Consider how SQL treats missing information.
You got /4 concepts.
Practice
(1/5)
1. What is the result of the SQL expression TRUE AND NULL?
easy
A. TRUE
B. NULL
C. FALSE
D. Error
Solution
Step 1: Understand AND with NULL
In SQL, AND returns FALSE if any side is FALSE. If one side is TRUE and the other is NULL, the result is NULL because the unknown value affects the outcome.
Step 2: Apply to TRUE AND NULL
Since the first operand is TRUE and the second is NULL, the result is NULL.
Final Answer:
NULL -> Option B
Quick Check:
TRUE AND NULL = NULL [OK]
Hint: AND with NULL returns NULL unless FALSE present [OK]
Common Mistakes:
Assuming TRUE AND NULL is TRUE
Confusing NULL with FALSE
Thinking NULL causes error
2. Which of the following is the correct SQL syntax to check if a column col is NOT NULL?
easy
A. col != NULL
B. col <> NULL
C. col IS NOT NULL
D. NOT col = NULL
Solution
Step 1: Recall NULL comparison rules
In SQL, you cannot use = or != to compare with NULL. Instead, use IS NULL or IS NOT NULL.
Step 2: Identify correct syntax
The correct way to check if col is not null is col IS NOT NULL.
Final Answer:
col IS NOT NULL -> Option C
Quick Check:
Use IS NOT NULL for null checks [OK]
Hint: Use IS NOT NULL, not != or <> [OK]
Common Mistakes:
Using != or <> to compare with NULL
Using NOT col = NULL which is invalid
Confusing NULL with empty string
3. Given a table Test with a column flag that can be TRUE, FALSE, or NULL, what is the result of this query?
SELECT * FROM Test WHERE flag OR FALSE;
medium
A. Rows where flag is TRUE
B. Rows where flag is TRUE or NULL
C. Rows where flag is TRUE or FALSE
D. No rows returned
Solution
Step 1: Understand OR with FALSE
In SQL, OR FALSE returns the value of the first operand because FALSE does not affect the OR result.
Step 2: Evaluate flag OR FALSE
If flag is TRUE, the expression is TRUE. If flag is FALSE, expression is FALSE. If flag is NULL, expression is NULL (unknown), which is treated as FALSE in WHERE filtering.
Final Answer:
Rows where flag is TRUE -> Option A
Quick Check:
flag OR FALSE = flag; WHERE filters TRUE only [OK]
Hint: OR FALSE returns first operand value [OK]
Common Mistakes:
Including NULL rows in result
Thinking OR FALSE always returns TRUE
Confusing OR with AND behavior
4. Consider this SQL WHERE clause:
WHERE NOT (col = NULL)
What is the problem with this condition?
medium
A. It always returns NULL (no rows match)
B. It always returns TRUE
C. It always returns FALSE
D. It causes a syntax error
Solution
Step 1: Understand comparison with NULL
In SQL, col = NULL always returns NULL (unknown), never TRUE or FALSE.
Step 2: Apply NOT to NULL
NOT NULL is still NULL, so the condition never evaluates to TRUE, filtering out all rows.
Final Answer:
It always returns NULL (no rows match) -> Option A
Quick Check:
NOT (col = NULL) = NULL, no matches [OK]
Hint: NOT NULL remains NULL, no rows pass filter [OK]
Common Mistakes:
Expecting NOT NULL to be TRUE
Using = NULL instead of IS NULL
Assuming syntax error occurs
5. You want to select rows from a table Employees where the ManagerID is either NULL or the employee is active (Active = TRUE). Which WHERE clause correctly handles NULL logic?
hard
A. WHERE ManagerID IS NOT NULL OR Active = TRUE
B. WHERE ManagerID = NULL OR Active = TRUE
C. WHERE NOT ManagerID = NULL AND Active = TRUE
D. WHERE ManagerID IS NULL OR Active = TRUE
Solution
Step 1: Correctly check for NULL
Use IS NULL to check if ManagerID is NULL. Using = NULL is invalid and returns NULL.
Step 2: Combine conditions with OR
The condition requires rows where ManagerID is NULL or Active is TRUE, so use OR between these checks.
Final Answer:
WHERE ManagerID IS NULL OR Active = TRUE -> Option D
Quick Check:
Use IS NULL and OR for correct logic [OK]
Hint: Use IS NULL, combine with OR for either condition [OK]
Common Mistakes:
Using = NULL instead of IS NULL
Using AND instead of OR
Using IS NOT NULL which is opposite
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.