[LeetCode] 181. Employees Earning More Than Their Managers

2022. 11. 27. 15:18TIL💡/Database

https://leetcode.com/problems/calculate-special-bonus/?envType=study-plan&id=sql-i 

 

Calculate Special Bonus - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

어차피 Manager도 Employee의 일부로 이것도 셀프 조인 문제로, 굉장히 많이 보였던 유형이다.

SELECT e1.name AS Employee
FROM Employee e1 
JOIN Employee e2
ON e1.managerId = e2.id
WHERE e1.salary > e2.salary;