융무의 기술블로그
article thumbnail

https://leetcode.com/problems/employees-earning-more-than-their-managers/

 

Employees Earning More Than Their Managers - 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

Problem                                                                                                                      

Analysis                                                                                                                     

1. Id와 ManagerId가 같은걸 JOIN 한다.

2.Salary가 managers 보다 사람을 찾는다.

 

Solution                                                                                                                    

SELECT E.Name AS Employee
FROM Employee AS E
JOIN Employee AS A ON E.ManagerId = A.Id 
WHERE E.Salary > A.Salary 

 

profile

융무의 기술블로그

@융무

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!