Why did MS provide LEFT and RIGHT OUTER JOIN?

sql server India
  • 13 years ago

     Dear Developers,

     I hv one doubt....  herewith explain my doubt with eample

     tblItem_M  : Item_Code, Item_Desc

     tblOrder  : Order_ID,Item_Code,Qty,Price...

      When i use

       SELECT M.Item_Code,M.Item_Desc FROM tblItem_M M

                  LEFT OUTER JOIN tblOrder O ON M.Item_Code=O.Item_Code

      SELECT M.Item_Code,M.Item_Desc FROM tblOrder O

                  RIGHT OUTER JOIN tblItem_M M ON O.Item_Code=M.Item_Code

     In the above both SQL query will return same data...in the second query also return the same records that what i got in the first query...but  i m using RIGHT OUTER JOIN and inter change the table.

    My doubt is why did Microsoft provide  both LEFT and RIGHT OUTER JOIN. we can achieve LEFT OUTER JOIN itself other wise RIGHT OUTER JOIN itself just interchange the table...

    great tips would be appreciated...tnx in advance...

    Regards 

    Hari K......
     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic