Lukas Eder has a comprehensive guide to joining data using SQL:
Alternative syntaxes: NATURAL JOIN
An more extreme and much less useful form of
"EQUI" JOIN
is theNATURAL JOIN
clause. The previous example could be further “improved” by replacingUSING
byNATURAL JOIN
like this:SELECT * FROM actor NATURAL JOIN film_actor NATURAL JOIN filmNotice how we no longer need to specify any
JOIN
criteria, because aNATURAL JOIN
will automatically take all the columns that share the same name from both tables that it joins and place them in a “hidden”USING
clause. As we’ve seen before, as primary keys and foreign keys have the same column name, this appears quite useful.
There is a high likelihood that you will learn at least one new thing here; for example, check out lateral joins (which SQL Server practitioners know as something else).