LeetCode - 181. Employees Earning More Than Their Managers (MySQL)

조민수·2024년 6월 21일
0

LeetCode

목록 보기
40/61

Easy, SQL - Self Reference

RunTime : 884 ms


문제

Write a solution to find the employees who earn more than their managers.

Return the result table in any order.

The result format is in the following example.


풀이

  • 자기 테이블 참조 문제, 초기엔 어려웠는데 차츰 익숙해지는중
SELECT a.name as Employee FROM Employee as a
WHERE a.salary > (SELECT b.salary FROM Employee as b WHERE b.id = a.managerId)
profile
사람을 좋아하는 Front-End 개발자

0개의 댓글