← 🗄️ Data & SQL EngineeringNEXT IN DATA & SQL ENGINEERINGRanking and Top-N Per Group→
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
SQL & Data EngineeringExplain SQL set operations (UNION/INTERSECT/EXCEPT) and NULL handling pitfalls.→SQL & Data EngineeringImplement Slowly Changing Dimension Type 2 history tracking in a Delta lakehouse.→SQL & Data EngineeringGroup a stream of user events into sessions in SQL (30-minute inactivity gap) using window functions.→SQL & Data EngineeringFind the top-N records per group and a running total per group in SQL.→SQL & Data EngineeringHow do you find and remove duplicate rows in SQL, including 'fuzzy' near-duplicates?→SQL & Data EngineeringExtract and clean a usable dataset from a messy real-world database using SQL plus Python (dedupe, types, nulls, joins, validation).→
COMPANIES THAT ASSUME THIS
