Challenge - 5 Problems
SQL NULL Logic Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate1:30remaining
Output of AND with NULL
What is the result of the following SQL expression?
SELECT TRUE AND NULL AS result;SQL
SELECT TRUE AND NULL AS result;
Attempts:
2 left
💡 Hint
Remember that NULL means unknown in SQL logic.
✗ Incorrect
In SQL, TRUE AND NULL results in NULL because the truth value is unknown when combined with TRUE.
❓ query_result
intermediate1:30remaining
Output of OR with NULL
What is the result of this SQL expression?
SELECT FALSE OR NULL AS result;SQL
SELECT FALSE OR NULL AS result;
Attempts:
2 left
💡 Hint
Think about how OR behaves when one operand is unknown.
✗ Incorrect
FALSE OR NULL results in NULL because the overall truth is unknown when combined with FALSE and NULL.
❓ query_result
advanced1:30remaining
Output of NOT with NULL
What is the result of this SQL expression?
SELECT NOT NULL AS result;SQL
SELECT NOT NULL AS result;
Attempts:
2 left
💡 Hint
NOT reverses TRUE to FALSE and FALSE to TRUE, but what about NULL?
✗ Incorrect
NOT NULL results in NULL because negation of unknown remains unknown in SQL.
🧠 Conceptual
advanced2:00remaining
Understanding NULL in complex AND/OR expressions
Consider the expression:
What is the output?
SELECT (TRUE OR NULL) AND FALSE AS result;What is the output?
SQL
SELECT (TRUE OR NULL) AND FALSE AS result;
Attempts:
2 left
💡 Hint
Evaluate the OR part first, then AND with FALSE.
✗ Incorrect
TRUE OR NULL is TRUE because TRUE dominates OR. Then TRUE AND FALSE is FALSE.
🧠 Conceptual
expert2:30remaining
Behavior of NULL in NOT combined with AND and OR
What is the result of this SQL expression?
SELECT NOT (FALSE AND NULL) OR (NULL AND TRUE) AS result;SQL
SELECT NOT (FALSE AND NULL) OR (NULL AND TRUE) AS result;
Attempts:
2 left
💡 Hint
Evaluate inside parentheses first, then apply NOT and OR.
✗ Incorrect
FALSE AND NULL is FALSE (because FALSE AND anything is FALSE). NOT FALSE is TRUE. NULL AND TRUE is NULL. TRUE OR NULL is TRUE.