Recall & Review
beginner
What are the three possible truth values in SQL's three-valued logic?
The three truth values are TRUE, FALSE, and UNKNOWN. UNKNOWN represents a condition where the truth cannot be determined, often due to NULL values.
Click to reveal answer
beginner
How does SQL treat NULL in logical expressions?
In SQL, NULL represents an unknown or missing value. When used in logical expressions, it results in the UNKNOWN truth value, which affects the outcome of conditions.
Click to reveal answer
intermediate
What is the result of the expression: TRUE AND UNKNOWN in SQL?
The result is UNKNOWN because TRUE AND UNKNOWN cannot be determined as TRUE or FALSE due to the unknown part.
Click to reveal answer
intermediate
Explain the behavior of the NOT operator when applied to UNKNOWN in SQL.
NOT UNKNOWN results in UNKNOWN. Negating an unknown truth value remains unknown because the truth is still not determined.
Click to reveal answer
beginner
Why is three-valued logic important in SQL queries involving NULLs?
Three-valued logic allows SQL to handle NULLs safely by introducing UNKNOWN. This prevents incorrect TRUE or FALSE assumptions when data is missing or unknown, ensuring accurate query results.
Click to reveal answer
What does the UNKNOWN truth value represent in SQL?
✗ Incorrect
UNKNOWN means the truth of the condition cannot be determined, often due to NULL values.
What is the result of NULL OR TRUE in SQL's three-valued logic?
✗ Incorrect
NULL OR TRUE evaluates to TRUE because OR returns TRUE if any operand is TRUE.
Which logical operator in SQL can return UNKNOWN as a result?
✗ Incorrect
AND, OR, and NOT can all return UNKNOWN when NULLs are involved.
What happens when you compare a value to NULL using = in SQL?
✗ Incorrect
Comparing anything to NULL with = results in UNKNOWN because NULL means unknown value.
How does SQL treat the expression: NOT FALSE?
✗ Incorrect
NOT FALSE is TRUE in SQL's logic.
Describe how three-valued logic works in SQL and why it is necessary.
Think about how missing data affects truth in conditions.
You got /3 concepts.
Explain the result of logical operations (AND, OR, NOT) when one operand is UNKNOWN.
Consider how unknown truth affects each operator.
You got /3 concepts.