[LeetCode] 184. Department Highest Salary

2022. 6. 7. 00:49SQL

내 쿼리

SELECT d.name AS Department
    ,e.name AS Employee
    ,e.salary AS Salary
FROM employee AS e
INNER JOIN department AS d
ON e.departmentid = d.id
WHERE (e.departmentid ,e.salary)
    IN (SELECT departmentid , MAX(salary) FROM employee GROUP BY departmentid )

 

SQL은 다중 컬럼 인덱싱이 가능하다 

'SQL' 카테고리의 다른 글

[HackerRank] Weather Observation Station 3  (0) 2022.06.07
[LeetCode] 178. Rank Scores  (0) 2022.06.07
SQL - 심화 2  (0) 2022.03.20
SQL - 심화1  (0) 2022.03.20
View  (0) 2022.03.20