Reading the NULL Row as "No Match Found"
Concepts covered: sqlNullInJoins
This is the section the interview question exists to test. NOT IN with a NULL in the subquery returns zero rows. Not 'some' rows. Not 'wrong' rows. Zero. The dashboard reads zero. The on-call gets paged. The candidate who has not seen this learns it the hard way. The candidate who has seen it defaults to NOT EXISTS and avoids the trap entirely. The bug, demonstrated Why this is the language's behavior, not a bug SQL has three truth values: TRUE, FALSE, and UNKNOWN. Comparing any value to NULL returns UNKNOWN. The behavior is consistent with how NULL works everywhere else: 5 = NULL is UNKNOWN, 5 != NULL is UNKNOWN, NULL = NULL is UNKNOWN. NOT IN is built on top of !=, so it inherits the UNKNOWN behavior. The language is doing what it says it does. The trap is that this behavior is rarely wh
About This Interactive Section
This section is part of the Anti-Join: Beginner lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.
How DataDriven Lessons Work
DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.