Employee
ํ ์ด๋ธ์ ์ค๋ณต์ผ๋ก ํ์ฉํ์ฌ ๋ณํฉ
Employee as e
(์ง์ ํ ์ด๋ธ)
Employee as m
(๋ฉ๋์ ธ ํ ์ด๋ธ)- ์ง์ ํ ์ด๋ธ์
managerId
๋ฅผ ๊ธฐ์ค์ผ๋ก ๋ฉ๋์ ธ ํ ์ด๋ธ์ id๋ฅผ ํ์ฉํ์ฌ ๋ณํฉ
LEFT JOIN
ON e.managerId = m.id
- ์ง์์
salary
๊ฐ ๋ฉ๋์ ธ์salary
๋ณด๋ค ๋์ ๊ฒฝ์ฐ
WHERE e.salary > m.salary
SELECT e.name as Employee
FROM Employee as e
LEFT JOIN Employee as m
ON e.managerID = m.id
WHERE e.salary > m.salary