Combining Tables With JOINs That Actually Match What You Want
How to write joins that don’t backfire
Joining tables is one of the most common things you’ll do when working with a database. But there’s a big difference between just writing a JOIN
and writing one that actually returns the rows you meant to get. Most guides give you the surface-level difference between INNER and OUTER joins, but they rarely cover how the actual rows behave when you mix in filters, missing matches, nulls, and real-world data.
What Really Happens When You JOIN Tables
Not every join gives you the result you thought you’d get. The way databases match rows is mechanical, and if you’re not careful about what goes where, the output can shift in ways that don’t always make sense at first. Before getting into real-world joins, it helps to know exactly what the engine does during that matching process.
Keep reading with a 7-day free trial
Subscribe to Alexander Obregon's Substack to keep reading this post and get 7 days of free access to the full post archives.