Self Join to Find Employee Pairs in Same Department
Medium
joins
Airbnb
Uber
LinkedIn
Write a query using a self join to find all pairs of employees who work in the same department. Return employee1, employee2, and department. Only show each pair once (employee1 < employee2 alphabetically). Order by department, then employee1.
Expected Output: Unique pairs of employees sharing a department.
Tables
Hints (3 available)
SQL Editor
Output
Click "Run" to see results...