https://leetcode.com/problems/employees-earning-more-than-their-managers/
Write an SQL query to find the employees who earn more than their managers.
Return the result table in any order.
The query result format is in the following example.
+----------+
| Employee |
+----------+
| Joe |
+----------+
조회할 데이터 : 사수보다 더 많이 버는 사람의 이름을 출력
조건1. 직원 이름 컬럼을 Employee라고 별칭을 줄 것
SELECT employee.name AS Employee
FROM employee as Employee
LEFT JOIN employee AS Manager ON Employee.managerid = Manager.id
WHERE Employee.salary > Manager.salary
- 하나의 테이블을 SELF JOIN하는 문제
- SELF JOIN 할 때는 각각의 테이블에 꼭 별칭을 주어야 한다. (구분하기 위함)