Multi-Column Anti-Joins and Composite Keys
Concepts covered: sqlExists
The escalation: 'find users who visited page A but never page B on the same day.' One condition is no longer enough; the anti-match has to consider multiple columns at once. The form choice matters again, and the same NULL trap reappears in a slightly different shape. The multi-column version Express the absence with NOT EXISTS, joining the subquery on every column that defines the match. The subquery joins on three columns: user_id, visit_date, and page. The visit_date join is what enforces 'on the same day.' Without it, a user who visited page A today and page B last month would be excluded, which is wrong. The interviewer will sometimes ask you to walk through a test case with one user who visited both pages on different days; the multi-column join is what handles that correctly. The LE
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.