Reference

RIGHT JOIN

Mirror of LEFT JOIN: preserves every row from the right-side table. In practice, almost never used: a RIGHT JOIN b reads more naturally as b LEFT JOIN a, so most teams standardize on LEFT JOIN everywhere and leave RIGHT JOIN on the shelf.

Syntax #

sql
SELECT a.id, b.value_col
FROM a
RIGHT JOIN b ON a.key = b.key;

Example #

Loading SQL editor...
Info

Just rewrite it as LEFT JOIN. orders RIGHT JOIN users ON ... is semantically identical to users LEFT JOIN orders ON ...: same result, consistent reading order (outer-preserved table first), and matches the rest of your codebase. The only time RIGHT JOIN earns its keep is inside a join chain where flipping the driving table would cascade other changes.