Your HR team wants to flag employees who earn the same salary as a colleague in the same department. Using the employees table, find all pairs of employees in the same department with equal salaries. To avoid listing the same pair twice, only include pairs where the first employee's id is less than the second's.
Return employee1, employee2, department, and salary. Sort by salary.
employees
| column | type |
|---|---|
| id | INTEGER |
| name | TEXT |
| department | TEXT |
| salary | NUMERIC |
| id | name | department | salary |
|---|---|---|---|
| 1 | Alice | Engineering | 90000 |
| 2 | Bob | Engineering | 90000 |
| 3 | Carol | Marketing | 75000 |
| 4 | Dave | Marketing | 75000 |
| 5 | Eve | Engineering | 80000 |
| employee1 | employee2 | department | salary |
|---|---|---|---|
| Carol | Dave | Marketing | 75000 |
| Alice | Bob | Engineering | 90000 |
Alice and Bob both earn 90000 in Engineering — they form a pair. Carol and Dave both earn 75000 in Marketing — they form a pair. Eve has no salary match in Engineering, so she does not appear.