Pairs of Employees in the Same Department
Medium
Joins
Return every unordered pair of employees working in the same department, once, with the smaller id first. Order by the first id, then the second.
Table schema
Employees(id INT PRIMARY KEY, name VARCHAR(50), department_id INT)Sample data
id | name | department_id
1 | A | 1
2 | B | 1
3 | C | 1
4 | D | 2
Discussion
No discussions yet.
Join Shalyam Newsletter
Get exclusive insights with every issue: education, research and innovation news.
Shalyam Support
Hi! Ask us anything โ we'll reply on WhatsApp or Telegram within 24 hours.