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?

Intermediateโฑ 2 Minutesโญ 430 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