RIGHT (OUTER) JOIN: Mirror of LEFT JOIN — keeps every row from the right table. Rare in practice; people just flip the tables. A RIGHT JOIN is the mirror image of a LEFT JOIN. It keeps every row from the right-hand table, and fills in NULL where the left table has no match.
Frequently asked questions about RIGHT (OUTER) JOIN
How is RIGHT (OUTER) JOIN used in practice?
In practice it is rarely used, because you can get the same result by swapping the tables and writing a LEFT JOIN. Most developers find queries easier to read when the main table comes first and everything else is joined to it from the left.
What should you keep in mind with RIGHT (OUTER) JOIN?
If you see a RIGHT JOIN in existing code, it is not wrong, just less common. Rewriting it as a left join with the tables swapped often makes the query clearer for the next reader. As with any outer join, put conditions on the optional table in the ON clause rather than in WHERE, or the outer join quietly becomes an inner one.
What does an example of RIGHT (OUTER) JOIN look like?
SELECT u.name, o.total FROM users u RIGHT JOIN orders o ON o.user_id = u.id;