AppliedAIPrep logoAppliedAI/Prep
🗄️ Data & SQL Engineering
Core

NULLs and Three-Valued Logic

NULL means unknown, so SQL uses three-valued logic where comparisons with NULL return UNKNOWN, not TRUE or FALSE. This is the quiet source of wrong results: = NULL never matches, NOT IN silently drops every row when the subquery contains a NULL, and aggregates and outer joins treat NULL in surprising ways. Applied-AI interviews probe it because confidently wrong queries that pass review are worse than queries that error, and NULL handling is where they hide.

a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
COMPANIES THAT ASSUME THIS
NEXT IN DATA & SQL ENGINEERINGRanking and Top-N Per Group