user3347915
user3347915

Reputation: 21

If I have two tables I want to use join operation and if I have left join then what is the use of right join?

If I have two tables I want to use join operation and if I have left join then what is the use of right join?

I have two tables A and B

I will use like

SELECT * FROM A LEFT OUTER JOIN B ON A.Id=B.Id 

If I want B table as outer

SELECT * FROM B LEFT OUTER JOIN A ON B.Id=A.Id

then what is the use of right outer join?

Upvotes: 0

Views: 28

Answers (1)

Robert Columbia
Robert Columbia

Reputation: 6418

Having both joins helps one write intuitive scripts that are easier to understand. It is similar to why most programming languages have a less than comparison operator as well as a greater than comparison operator. In theory, most (if not all) code could be rewritten to use only one of them, but that code would be more difficult to understand and maintain.

Upvotes: 2

Related Questions