Skip to main content
SQL โ€ข LESSON 80

RIGHT JOIN

How can we preserve every department while matching employees?

Intermediateโฑ 3 Minutesโญ 930 XP
๐Ÿค” THE QUESTION

How can we preserve every department while matching employees?

๐Ÿ’ก WHAT IS IT?

A RIGHT JOIN preserves all rows from the right table regardless of whether a match exists on the left.

๐ŸŽฏ WHAT IS IT USED FOR?

Department-centric audits, ensuring every department appears in the roster even if empty.

๐Ÿ’ป EXAMPLE
SELECT e.name, d.department_name
FROM employees e
RIGHT JOIN departments d
ON e.department_id = d.department_id;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for RIGHT JOIN.

  • โœ“ RIGHT JOIN
  • โœ“ Right table preservation
  • โœ“ Comprehensive department listings
  • โœ“ Relational joins