0
0
SQLquery~5 mins

NULL behavior in comparisons in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does NULL represent in SQL?
NULL represents a missing or unknown value in a database. It is not the same as zero or an empty string.
Click to reveal answer
beginner
What is the result of comparing NULL with any value using = or <>?
The result is UNKNOWN, which behaves like FALSE in WHERE clauses. NULL = NULL does not return TRUE.
Click to reveal answer
beginner
How do you properly check if a column value is NULL?
Use IS NULL or IS NOT NULL to check for NULL values instead of = or <>.
Click to reveal answer
intermediate
What is the result of NULL OR TRUE in SQL?
The result is TRUE because TRUE in OR makes the whole expression TRUE regardless of NULL.
Click to reveal answer
intermediate
Why does NULL cause three-valued logic in SQL?
Because NULL means unknown, comparisons can be TRUE, FALSE, or UNKNOWN, affecting query results and filters.
Click to reveal answer
What does the expression NULL = NULL return in SQL?
AUNKNOWN
BFALSE
CTRUE
DNULL
Which SQL syntax correctly checks if a column 'age' is NULL?
Aage = NULL
Bage = ''
Cage IS NULL
Dage <> NULL
What is the result of the condition NULL AND TRUE?
AUNKNOWN
BFALSE
CNULL
DTRUE
If a WHERE clause condition evaluates to UNKNOWN, what happens to that row?
AIt is converted to TRUE
BIt is included in the result
CIt causes an error
DIt is excluded from the result
Which logical operator can turn a NULL value into TRUE in an expression?
AAND
BOR
CNOT
DXOR
Explain how NULL affects comparison operations in SQL and how to properly check for NULL values.
Think about why NULL = NULL is not TRUE.
You got /3 concepts.
    Describe the three-valued logic in SQL caused by NULL and how it impacts query filtering.
    Consider how NULL changes AND, OR, and NOT results.
    You got /3 concepts.