Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Why Right join

Author  Topic 

anil_p
Starting Member

3 Posts

Posted - 2012-10-31 : 06:22:59
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
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-31 : 07:02:31
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
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2012-10-31 : 12:20:31
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
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-10-31 : 17:04:13
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
   

- Advertisement -