Geeks Talk

Prepare for your Next Interview




Types of Joins in SQL

This is a discussion on Types of Joins in SQL within the SQL Server forums, part of the Databases category; Hi pls can any one tel me and explain types of Joins in SQL??...


Go Back   Geeks Talk > Databases > SQL Server

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 11-05-2007
Junior Member
 
Join Date: Nov 2007
Location: Mysore
Posts: 1
Thanks: 0
Thanked 3 Times in 1 Post
Adarsh B is on a distinguished road
Types of Joins in SQL

Hi pls can any one tel me and explain types of Joins in SQL??
Reply With Quote
The Following 3 Users Say Thank You to Adarsh B For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 11-05-2007
Moderator
 
Join Date: Jun 2007
Location: Bangalore,India
Posts: 1,426
Thanks: 8
Thanked 125 Times in 112 Posts
debasisdas will become famous soon enoughdebasisdas will become famous soon enough
Re: Types of Joins in SQL

Please find the details here.
Reply With Quote
The Following User Says Thank You to debasisdas For This Useful Post:
  #3 (permalink)  
Old 11-28-2007
Junior Member
 
Join Date: Jun 2006
Location: Calcutta
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
samu is on a distinguished road
Re: Types of Joins in SQL

Hello, Thank U...........
Reply With Quote
  #4 (permalink)  
Old 07-23-2008
Junior Member
 
Join Date: Jul 2008
Location: hyderabad
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
krishna420 is on a distinguished road
Re: Types of Joins in SQL

1. Inner join 2. Outer join 3. Cross join 1. Inner join: inner join is the default type of join, it will producesses the result set, which contains matched rows only. Syntax: select * from table1<innerjoin>table2 2. Outer join: outer join produces the results, which contains matched rows and unmatched rows. Here we have three types of joins, 1.left outer join 2.right outer join 3.full outer join left outer join: left outer join producesses the results, which contains all the rows from left table and matched rows from right table. Syntax: select * from table1<leftouterjoin>table2 right outer join: right outer join producesses the resultset, which contains all the rows from right table and matched rows from left table. Syntax:select * from table1<right outer join>table2 full outer join: full outer join producesses the resultset, which contains all the rows from left table and all the rows from right table. Syntax:select * from table1<fullouterjoin>table2 3.cross join: a join without having any condition is known as cross join, in cross join every row in first table is joins with every row in second table. Syntax: select * from table1<cross join>table2 self join: a join joins withitself is called self join working with self joins we use alias tables.
Reply With Quote
  #5 (permalink)  
Old 07-24-2008
Junior Member
 
Join Date: Jul 2008
Location: Hyderabad
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
mobinsk is on a distinguished road
Re: Types of Joins in SQL

We have three types of Joins in sql.
They are
1. Inner join
2. Outer join
3. Cross join

1. Inner join:
Inner join is the default type of join, it will producesses the result set, which contains matched rows only.

Syntax: select * from table1<innerjoin>table2
Here noneed of specifying innerjoin. Simply we can specify Join also.

Syntax: select * from table1<join>table2

2. Outer join:
Outer join produces the results, which contains matched rows and unmatched rows.

Outer join is further classified as three types.They are
1.left outer join
2.right outer join
3.full outer join.

a.Left outer join:
Left outer join producesses the results, which contains all the rows from left table and matched rows from right table.

Syntax: select * from table1<leftouterjoin>table2

b.Right outer join:
Right outer join producesses the resultset, which contains all the rows from right table and matched rows from left table.

Syntax:select * from table1<right outer join>table2

c.Full outer join:
Full outer join producesses the resultset, which contains all the rows from left table and all the rows from right table.

Syntax:select * from table1<fullouterjoin>table2

3.Cross join:
A join without having any condition is known as cross join, in cross join every row in first table is joins with every row in second table. Cross join is nothing but cortizion product.

Syntax: select * from table1<cross join>table2

Self join:
A join joins withitself is called self join working with self joins we use alias tables.
Reply With Quote
  #6 (permalink)  
Old 07-24-2008
Junior Member
 
Join Date: Jul 2008
Location: Hyderabad
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
mobinsk is on a distinguished road
Re: Types of Joins in SQL

We have three types of Joins in sql.
They are
1. Inner join
2. Outer join
3. Cross join

1. Inner join:
Inner join is the default type of join, it will producesses the result set, which contains matched rows only.

Syntax: select * from table1 <innerjoin> table2 where <condition>
Here noneed of specifying innerjoin. Simply we can specify Join also.

Syntax: select * from table1 <join> table2 where <condition>

2. Outer join:
Outer join produces the results, which contains matched rows and unmatched rows.

Outer join is further classified as three types.They are
1.left outer join
2.right outer join
3.full outer join.

a.Left outer join:
Left outer join producesses the results, which contains all the rows from left table and matched rows from right table.

Syntax: select * from table1 <leftouterjoin> table2 where <condition>

b.Right outer join:
Right outer join producesses the resultset, which contains all the rows from right table and matched rows from left table.

Syntax:select * from table1 <right outer join> table2 where <condition>

c.Full outer join:
Full outer join producesses the resultset, which contains all the rows from left table and all the rows from right table.

Syntax:select * from table1 <fullouterjoin> table2 where <condition>

3.Cross join:
A join without having any condition is known as cross join, in cross join every row in first table is joins with every row in second table. Cross join is nothing but cortizion product.

Syntax: select * from table1<cross join>table2

Self join:
A join joins withitself is called self join working with self joins we use alias tables.
Reply With Quote
Reply

  Geeks Talk > Databases > SQL Server


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
How the joins work in SQL savitha_shankar Database General 11 07-15-2008 11:06 AM
Different types of commits praveenladdu1 Oracle 1 12-19-2007 05:41 AM
tell me the query using joins and count! ramesh_vwk SQL 3 08-20-2007 05:42 AM
I want to tune four tables and 5 joins condition Caleb Sima and Vincent Li Oracle 2 06-29-2007 09:19 AM
Types of functions are available in QTP Geek_Guest QTP 0 06-26-2007 07:31 AM


All times are GMT -4. The time now is 01:32 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved