https://leetcode.com/problems/employees-earning-more-than-their-managers/
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
'Algorithm > SQL' 카테고리의 다른 글
[SQL][Leetcode] 183. Customers Who Never Order (0) | 2020.06.21 |
---|---|
[SQL][Leetcode] 182. Duplicate Emails (0) | 2020.06.21 |
[SQL][Leetcode] 177. Nth Highest Salary (0) | 2020.06.19 |
[SQL][Leetcode] 176. Second Highest Salary (0) | 2020.06.19 |
[SQL][Leetcode] 175. Combine Two Tables (0) | 2020.06.19 |