The NOT IN NULL Trap That Returns Zero Rows

Concepts covered: sqlNullInJoins

Three forms produce the same answer on clean data. Knowing all three, and being able to deliver each one from memory, is the floor. Knowing which one to reach for is what the interviewer is scoring. Form 1: LEFT JOIN WHERE NULL Join the two tables with a LEFT JOIN, then filter for rows where the right side is NULL. The NULL appears for rows in the left table that did not match any row in the right table. This is the form most candidates default to because it is the most explicit: you can see the join, you can see the filter, and you can trace the row count by hand. The trace: the LEFT JOIN keeps every customer, attaching their orders where they exist and NULLs where they do not. The WHERE filter keeps only the rows where the orders side is NULL, which is exactly the set of customers with n

About This Interactive Section

This section is part of the Anti-Join: Intermediate 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.