JOIN
operation on the Employee
table with itself, aliasing one instance as a
(representing the employee) and the other as b
(representing the manager).ON
clause to specify the join condition: a.managerId = b.id
. This condition ensures that we are comparing each employee with their respective manager.ON
clause: a.salary > b.salary
. This filters the joined rows to only include those where the employee's salary is greater than the manager's salary.Employee
for the output.erDiagram Employee { int id PK varchar name int salary int managerId FK }