How to Use Natural Joins
A natural join is a join operation that matches values from columns that have the same name on each of the tables participating in the join For example. if we
code a natural join using the Countries
and Regions
tables in the HR schema, the join column would be region_id
.
In general, the natural join will perform the join on all columns that have identical names.
To learn how to use natural joins, follow these steps:
- You'll need to download and install Oracle 12c. The instructions for the setup can be found in How to use sample schemas. Follow steps 1 through 4 before proceeding to the next step.
- Let's display country name and its region name using a natural join. Execute the following select:
Note that I have displayed the first part of the output that contains 25 countries overall. The natural join will selectregion_id
as the join column because the column appears in both tables with the same name.