Join
Join
Department table =B
Nonequijoins
A nonequijoin is a join condition containing something other
than an equality operator.
On (between d.Gpa_lowest
And d. Gpa_highest)
INNER Versus OUTER Joins
• the join of two tables returning only matched rows
is called an inner join.
• A join between two tables that returns the results of
the inner join as well as the unmatched rows from
the left (or right) table is called a left (or right) outer
join.
• A join between two tables that returns the results of
an inner join as well as the results of a left and right
join is a full outer join.
1- Right outer join
2- Left outer join
3- Full outer join
Q1: query retrieves all rows in the student table, which is the
left table, even if there is no match in the DEPARTMENTS
table.
Select s.sname , s.age , d.dname
From student s left outer join departments d
On (d.did = s.dcode )
Section 1
• Natural joins:
– NATURAL JOIN clause
– USING clause
– ON clause
• The NATURAL JOIN clause is based on all columns in
the two tables that have the same name.
• It selects rows from the two tables that have equal
values in all matched columns.
• If the columns having the same names have
different data types, an error is returned.
• ______________________