SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Why Right join
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

anil_p
Starting Member

3 Posts

Posted - 10/31/2012 :  06:22:59  Show Profile  Reply with Quote
hi to all,


Why we have to use right join, we can swipe the tables and we can use lift join any one please help me on this.











sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 10/31/2012 :  07:02:31  Show Profile  Reply with Quote
Conceptually you are right - one should be able to swap the tables and make a left join into a right join. It exists for your convenience if you want to use it. Also, even though you may write a query using LEFT join, the query optimizer may make it into a RIGHT join (which would be transparent to you, of course).

Some interesting comments here: http://blog.sqlauthority.com/2010/11/28/sql-server-challenge-puzzle-why-does-right-join-exists/
Go to Top of Page

Transact Charlie
Flowing Fount of Yak Knowledge

United Kingdom
3451 Posts

Posted - 10/31/2012 :  12:20:31  Show Profile  Visit Transact Charlie's Homepage  Reply with Quote
I wonder if RIGHT JOIN is more prevalent in Asian cultures where the reading is right to left?


Transact Charlie
Msg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.
http://nosqlsolution.blogspot.co.uk/
Go to Top of Page

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 10/31/2012 :  17:04:13  Show Profile  Reply with Quote
I admit I don't use it much any more. However, using a right join was more prevalent on older versions of SQL becuase the optimizer used to join tables from right to left. So, you could "help" it out by joining the smaller tables first.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000