Skip to content
Advertisement

Is RIGHT JOIN Ever Required?

Do any queries exist that require RIGHT JOIN, or can they always be re-written with LEFT JOIN?

And more specifically, how do you re-write this one without the right join (and I guess implicitly without any subqueries or other fanciness):

Advertisement

Answer

You can always use only left Joins…

is equivilent to:

In general I always try to use only Left Joins, as the table on the left in a Left Join is the one whose rows are ALL included in the output, and I like to think of it, (The Left side) as the “base” set I am performing the cartesion product (join) against … So I like to have it first in the SQL…

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement