Ben Nadel Simplifies SQL JOINs After Claude Code

Ben Nadel writes that Claude Code convinced him to simplify how he writes SQL JOINs by moving row-level filters out of ON clauses and into WHERE clauses. In a May 2026 blog post, Nadel describes a longstanding habit of structuring queries so that FROM, INNER JOIN, and ON read as a top-to-bottom human narrative combining both relationship and filtering logic (Ben Nadel, bennadel.com). He illustrates the difference with a supermarket analogy and shows that the two styles are functionally equivalent at the database level. Editorial analysis: For practitioners, the post underscores a common readability tradeoff-keeping join logic focused on relationships and applying row filters later can improve human comprehension without changing query semantics.
What happened
Ben Nadel writes on bennadel.com that Claude Code convinced him to simplify how he structures SQL JOIN logic, shifting row-level filters out of ON clauses and into WHERE clauses. Nadel reports that, for roughly 20 years, he organized SQL so FROM, INNER JOIN, and ON read as a human narrative in which each ON clause expressed both the table relationship and filtering, and he shows a concrete FROM / INNER JOIN / ON example in the post.
Technical details
Per Nadel's examples, the two approaches are functionally equivalent: one places relationship plus filters together inside ON, the other uses ON for the relational predicate (e.g., p.isleID=i.id) and WHERE for row filters (e.g., i.number='3', p.type='Oatmeal', p.brand='Quaker'). Nadel emphasizes that this choice did not change how the database optimizer executes the query, and he uses a supermarket analogy to show why the human story influenced his prior style.
Editorial analysis - technical context
Developers and teams routinely face a readability versus locality tradeoff in SQL. Industry-pattern observations: many codebases and linters prefer keeping JOIN predicates focused on keys and relationships and moving selective filters into WHERE to make intent explicit. Tooling such as code-assistants and pair-programming agents often surface alternative formulations that prioritize clarity for human reviewers.
Context and significance
Editorial analysis: For maintainers of complex queries, consistent conventions around ON versus WHERE reduce cognitive load during code review and debugging, especially when queries grow to multiple joins and conditional logic. This is a readability and maintainability story rather than a performance one, since the optimizer typically reasons about equivalent predicate placement.
What to watch
Editorial analysis: Observe whether teams adopt linter rules or style guides that codify this separation, whether code-review comments increasingly call out predicate placement, and whether code-assistants like Claude Code surface the same recommendation across different SQL dialects. If present, these indicators suggest the guidance moves from individual preference to team convention.
Scoring Rationale
Practical developer ergonomics piece driven by a code-assistant's suggestion. Useful to SQL practitioners and teams but not a technical breakthrough or major industry event.
Practice interview problems based on real data
1,500+ SQL & Python problems across 15 industry datasets — the exact type of data you work with.
Try 250 free problems


