At
the top level there are mainly 3 types of joins:
- INNER
- OUTER
- CROSS
1.
INNER JOIN -
fetches data if present in both the tables.
2.
OUTER JOIN are
of 3 types:
LEFT OUTER JOIN - fetches data if present in the left table.
RIGHT OUTER JOIN - fetches data if present in the right table.
FULL OUTER JOIN - fetches data if present in either of the two tables.
CROSS
JOIN, that
joins everything to everything.
Similar to scenario where we simply lists the tables for joining (in the FROM clause of the SELECT statement), using commas to
separate them.
Points
to be noted:
If
you just mention JOIN then by default it is an INNER JOIN.
An OUTER join has to be LEFT | RIGHT | FULL you cannot simply
say OUTER JOIN.
You
can drop OUTER keyword
and just say LEFT JOIN or RIGHT JOIN or FULL JOIN.
Similar to scenario where we simply lists the tables for joining (in the FROM clause of the SELECT statement), using commas to separate them.
No comments:
Post a Comment