The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Given the Employee table, write a SQL query that finds out employees who earn more than their managers. For the above table, Joe is the only employee who earns more than his manager.
문제링크
SELECT e1.name AS Employee
FROM Employee AS e1
INNER JOIN Employee AS e2 ON e1.managerID = e2.ID
WHERE e1.salary > e2.Salary
-- SELF JOIN은 자기 자신의 테이블과 조인하는 것.
I found that solution very popular and helpful: https://www.youtube.com/watch?v=UbNU98fKV8o&ab_channel=EricProgramming