r/SQL • u/BrilliantLeast7083 • Mar 25 '26
Discussion When to use RIGHT JOIN instead of switching tables in Left Join
Hello all! I need some help with understanding the utility of Right join. I have 2 tables: Orders and Customers. If I write Orders RIGHT JOIN Customers it returns the same results as switching tables and using left join, like Customers LEFT JOIN Orders. But when these 2 examples can give different results? Like when it is mandatory to use right join instead of just switching tables in left join?
35
Upvotes
View all comments
Show parent comment
2
u/jshine13371 Mar 25 '26
I don't think there's any examples ever where
RIGHT JOINis explicitly required, as like most things, there's always an alternative. Just use cases where it's preferred.But the same example I mentioned above also applies to SQL Server / T-SQL for a different reason.
FULL JOINtends to be less performant of an implementation than using theUNIONimplementation I described, particularly when additional transformations are applied on top of it. Not always the case, but frequent enough that it's good to be aware of theUNIONtechnique as an optimization strategy.