Tell Me
 

Understanding Simple Joins

Previous previous|next Next Page

A natural join enables you to display data from two tables when the values of a column in one table correspond directly to the value in another column in the second table.

In a natural join, the two tables include one or more columns that have the same name and data types. A natural join retrieves all rows from the two tables that have equal values in all matched columns. Frequently, this type of join involves primary key and foreign key columns.

SELECT [DISTINCT] * | column [alias], ...
FROM table NATURAL JOIN
;

The USING clause enables you to specify the columns to be used for a join between two tables. The column names must be the same for both tables and must have compatible data types. Use the USING clause if your tables contain more than one column whose names match to explicitly identify the name of the columns that you want to join.

SELECT [DISTINCT] * | column [alias], ...
FROM table1 JOIN table2
USING common_col_name
;