Skip to main content
PYSPARK • LESSON 91

Right Outer Join Exploration

How do we keep all employee records while looking up their optional department details using a right join?

Intermediate2 Minutes430 XP
🤔 THE QUESTION

How do we keep all employee records while looking up their optional department details using a right join?

💡 WHAT IS IT?

departments.join(employees, 'department_id', 'right') preserves all records from the right-hand employee table.

🎯 WHAT IS IT USED FOR?

Preserving all child records when parent dimension records might be unassigned or missing.

💻 EXAMPLE
joined_df = departments.join(employees, "department_id", "right")

🎯 Mission Objectives

Practice typing production-grade PySpark code for Right Outer Join Exploration.

  • Execute right outer join
  • Preserve all right-side employee records
  • Handle unassigned department relationships