Join Operation
Join Operation
Management
Natural Join
Types of Join Operation
• Self Join: A table joins to itself.
• Cross join: Cartesian Product, there is no join condition
• Inner Join: Returns only the rows that have matching values in
both tables based on the join condition.
• If there is no match for a row in one
table, it is not included in the result set.
• Examples: Natural, Theta, EQUI
Inner Join
• Outer Join: Returns all the rows from one or both tables
involved in the join, regardless of whether there is a match
based on the join condition.
• If there is no match for a row in one table, the join operation includes
NULL values for the columns from the other table in the result set.
• Examples: Left, Right, Full
Inner Join: Natural Join (⋈)
• Natural join is a type of inner join in which there is no
need of any comparison operators.
• A natural join links tables by selecting only the rows
with common values in their common attribute(s).
• Columns should have the same name and domain. It
then combines the rows where the values in these
columns match.
• A natural join is the result of a three-stage process:
1. Create a PRODUCT of the tables
2. A SELECT is performed on the output of Step 1 to yield only the rows
for which the values are equal.
3. A PROJECT is performed on the results of Step 2 to yield a single copy
of each attribute, thereby eliminating duplicate columns.
Step 1
Step 2
Step 3
Inner Join: Theta (⋈θ)