NATURAL JOIN & USING
Writing out ON c.customer_id = o.customer_id gets repetitive when the join column has the exact same name in both tables, which happens constantly with well-designed foreign keys. SQL offers two shorthands for this specific situation: the USING clause, and the more aggressive NATURAL JOIN. Both can save typing, but only one of them is generally considered safe to use in production code.
USING: shorthand for an identical column name
When the join column has the same name in both tables — customer_id in both customers and orders, for instance — USING lets you name that column once instead of repeating table_a.column = table_b.column.
ON vs USING — identical results
-- Standard ON syntax SELECT c.name, o.order_id, o.amount FROM customers c JOIN orders o ON c.customer_id = o.customer_id; -- Equivalent, using USING SELECT c.name, o.order_id, o.amount FROM customers c JOIN orders o USING (customer_id);
Both queries return the identical result set. USING also has one small extra benefit over ON: the shared column (customer_id) appears only once in the output instead of twice, and it can be referenced unqualified (just customer_id, without a table prefix) in the SELECT list or WHERE clause, since there is no longer any ambiguity about which one you mean.
NATURAL JOIN: automatic, implicit matching
NATURAL JOIN goes a step further than USING: instead of naming the shared column yourself, it automatically joins on every column that has an identical name in both tables, with no ON or USING clause at all.
NATURAL JOIN — no explicit join column
SELECT name, order_id, amount FROM customers NATURAL JOIN orders;
name | order_id | amount -------+----------+------- Alice | 101 | 250.00 Alice | 102 | 75.50 Bob | 103 | 300.00 Carol | 104 | 120.00
Here, customer_id happens to be the only column shared between customers and orders, so NATURAL JOIN produces the same result as the ON/USING versions above. That word "happens" is exactly the problem.
Choosing between ON, USING, and NATURAL JOIN
In practice, ON is the safest default because the join condition is always fully explicit and immune to future schema changes. USING is a reasonable, low-risk shorthand when the column names genuinely match and you want slightly less repetition. NATURAL JOIN should generally be avoided outside of quick, throwaway queries against a schema you fully control and are not going to change.
USING (column)is shorthand forON a.column = b.columnwhen the column name matches in both tables.NATURAL JOINautomatically joins on every identically-named column, with no explicit condition at all.NATURAL JOIN's behavior can silently change if the schema later gains a new shared column name.
Most style guides recommend explicit ON clauses in production code, treating NATURAL JOIN as unsafe.