Skip to main content
SQL • LESSON 80

RIGHT JOIN

How can we preserve every department while matching employees?

Intermediate3 Minutes930 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