Sunday, 18 May 2014

Explain the use of the Join keyword and its various types.


The join keyword is very powerful in SQL. It can be used to combine rows from multiple tables by using
common values in certain fields. The type of join decides which rows are to be selected, while the
select statement specifies which fields to include in the combination table.


Inner Join
This is the default type of join. It picks all rows that have matching fields, or in other words, that meet the join condition.


Outer Join
A right outer join picks all rows from the table on the right, even if they do not meet the join condition. Some fields in such rows may have null values in the resulting table.A left outer join returns all rows of the left-side
table, irrespective of their match with the right-side table.


A full outer join returns all rows of the left- and
right-side tables.
Self Join

This is a special type of join where a table joins to
itself.

Cross Join
This is the Cartesian product of rows from the tables included in the join query statement. In other words,
every row from the first table is combined with every row of the second table, one at a time.


No comments:

Post a Comment