Self Join Employees Table Salary Comparison

Find employees who earn the same salary as their manager.

sql

SELECT e.name FROM employees e JOIN employees m ON e.manager_id = m.id WHERE e.salary = m.salary;

This query performs a self-join on the "employees" table to compare the "salary" of each employee with the "salary" of their respective manager, returning the names of those whose salaries match.

PromptDB can make mistakes. Please double-check responses.