Keep all rows from the right table.
Section: Joins
Right join
sql
sql
SELECT e.employee_id, d.department_name
FROM employees e
RIGHT JOIN departments d ON d.department_id = e.department_id;Explanation
Many teams prefer rewriting RIGHT JOIN as LEFT JOIN for consistency.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Joins