Three Table Joins
Three Table Joins
Learning Outcomes
- Learn how to perform a
CROSS JOIN
of two tables. - Learn how to perform a filtered
CROSS JOIN
of two tables. - Learn how to perform a
INNER JOIN
of two tables. - Learn how to perform a
NATURAL JOIN
of two tables. - Learn how to perform a
LEFT
,RIGHT
, andFULL OUTER JOIN
of two tables. - Learn how to perform a self join between two copies of the same table.
- Learn how to perform a non-equijoin between two tables.
Lesson Materials
You can joins rows between three tables by first joining one table to another and then the result of the first join to third table. While all the techniques for two table joins are supported, you will only cover the INNER JOIN
and self join.
You use an INNER JOIN
syntax to join two tables and two copies of a single table. A join between two copies of the same table is often called a self join.
INNER JOIN
INNER JOIN
matches every row in one table against every row in another table where the value in one column of a table matches the value in one column the other table. It is also possible that the unique key may include more than one column. In the latter case, the match between tables uses a set of columns from each table.- Self Join
- A self join occurs between a column or a set of columns in two copies of the same table. A self join works with
INNER
,LEFT
,RIGHT
, andFULL OUTER JOINS
.