SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Find Pairs of Employees in Same Department

Build mastery in Self Joins Hierarchical with this scenario-based SQL challenge and live execution support.

Problem Statement

Write a query to find pairs of employees who work in the same department (excluding self-pairs and avoiding duplicates). Return employee1_name, employee2_name, and department_id. Order by department and employee names.

Relevant Tables

employees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: