SQL Joins
SQL Joins
Types of Joins
1) Inner Join
• Natural Join
2) Left (Outer) Join
3) Right (Outer) Join
4) (Full) Outer Join
5) Left (Outer) Join Excluding Inner Join
6) Right (Outer) Join Excluding Inner Join
7) (Full) Outer Join Excluding Inner Join
8) Cross Join
9) Equi-Join
Sample Tables
TableA TableB
PK Value PK Value
1 FOX 1 TROT
2 COP 2 CAR
3 TAXI 3 CAB
6 WASHINGTON 6 MONUMENT
7 DELL 7 PC
5 ARIZONA 8 MICROSOFT
4 LINCOLN 9 APPLE
10 LUCENT 11 SCOTCH
Inner Join
• Inner join produces
only the set of records
that match in both
Table A and Table B
• Inner Joins do not have
to use equality to join
the fields
• Can use <, >, <>
• Most commonly
used
Inner Join
TableA TableB
Value PK PK Value
FOX 1 1 TROT
COP 2 2 CAR
TAXI 3 3 CAB
WASHINGTON 6 6 MONUMENT
DELL 7 7 PC