Pages

Men

rh

6/03/2012

Joins in SQL Server

Joins: Joins are used to retrieve the data from  multiple tables.

We can join maximum of 256 tables.

Types of Joins:

  •  Inner Join
  •  Outer Join
  •  Cross Join

Inner Join:  It is default join type. Result set will contain only matching rows from tables.

Outer Join:  
Outer Join can be classified into 3 types.
They are

  • Left Outer Join
  • Right Outer Join
  • Full join

Left Outer Join:
Incase of Left outer join result set will contain all the rows from  left table and only matching rows from right table.

Right Outer Join:
Incase of Right outer join result set will contain all the rows from  Right table and only matching rows from Left table.

Full Join:
Result set will contain all the rows from Right Table  and all the rows from left table.

Cross Join:
A join with out any condition. Every row in first table with every row in Second table.

Difference between Full outer Join and Cross join:
Full outer join requires condition but Cross join does not required any condition.








      

No comments :

Post a Comment