Part 64: RIGHT (OUTER) JOIN: Mechanics & Best Practices

Part 64 Technology Updated September 12, 2026

Part 64: RIGHT (OUTER) JOIN: Mechanics & Best Practices

A RIGHT JOIN returns all records from the right table, and matched records from the left table.


1. Why the Industry Avoids RIGHT JOIN

Any RIGHT JOIN can be rewritten as a LEFT JOIN simply by swapping table positions:

-- Query A (RIGHT JOIN):
SELECT * FROM orders o RIGHT JOIN customers c ON o.customer_id = c.id;

-- Query B (LEFT JOIN - Preferred):
SELECT * FROM customers c LEFT JOIN orders o ON c.id = o.customer_id;

Industry Standard: Most engineering teams enforce a convention: Always use LEFT JOIN, never RIGHT JOIN. Humans read left-to-right; maintaining consistent left joins makes complex multi-table queries significantly easier to reason about.


Key Takeaways

  • RIGHT JOIN is syntactically valid but rarely used in production codebases in favor of LEFT JOIN.

In Part 65, we explore FULL (OUTER) JOIN: Combining Both Sides!