I am looking to better build my SQL Development skill set. Where I work currently most all the data fits into a hierarchy and we almost always start with the top most element to work our way "down". This results in really only needing to use INNER
and LEFT OUTER
joins for the various queries.
I am hoping to get some guidance on a situation where I might need to use a RIGHT OUTER
and a LEFT OUTER
JOIN in the same query.
Referencing a previous question on StackOverflow What is the difference between Left, Right, Outer and Inner Joins? I understand what a RIGHT OUTER
and a LEFT OUTER
JOIN is, however all problems I have been asked to solve, could be solved using only INNER
and LEFT OUTER
joins.
EDIT:
I did find that this is basically a duplicate of a previous StackOverflow question When or why would you use a right outer join instead of left?. It would appear that in general there is a consensus that
- Most all queries using a
RIGHT OUTER JOIN
can be converted into anINNER
andLEFT OUTER
version. - There are some benefits for
read-ability formatting or organizational processes which might
require using a
RIGHT OUTER
instead of aLEFT OUTER
.
There is also an answer on that question which details a particular situation where you would INNER JOIN
a group of tables together and then RIGHT OUTER JOIN
to find where the "right" table has records in the whole INNER JOIN
'ed subset. I think this can be accomplished with an INNER JOIN
and LEFT OUTER JOIN
version it would just require some work.
RIGHT OUTER
and aLEFT OUTER JOIN
in the same query".RIGHT OUTER
... in the same query, so I want guidance on it", but it looks like you are understanding the question correctly.