랭킹 함수 차이3 [leetcode / MySQL] 185. Department Top Three Salaries 문제 💡 A company's executives are interested in seeing who earns the most money in each of the company's departments. A high earner in a department is an employee who has a salary in the top three unique salaries for that department. Write a solution to find the employees who are high earners in each of the departments. Return the result table in any order. 테이블 형태 풀이 SELECT Department, Employee, S.. 2024. 2. 1. [leetcode / MySQL] 511. Game Play Analysis1 문제 💡 Write a solution to find the first login date for each player. Return the result table in any order. 테이블 형태 풀이 SELECT player_id, first_login FROM ( SELECT ROW_NUMBER() OVER (PARTITION BY player_id ORDER BY event_date) AS row_n , player_id , event_date AS first_login FROM Activity ) activity WHERE row_n=1 해설 FROM ( SELECT ROW_NUMBER() OVER (PARTITION BY player_id ORDER BY event_date) AS row_.. 2024. 2. 1. [leetcode / MySQL] 184. Department Highest Salary 문제 💡 Write a solution to find employees who have the highest salary in each of the departments. Return the result table in any order. 테이블 형태 풀이 SELECT D.name AS Department , E.name AS Employee , salary AS Salary FROM Employee E INNER JOIN Department D ON E.departmentId = D.id WHERE (departmentId, salary) IN (SELECT departmentId, MAX(salary) FROM Employee GROUP BY departmentId) 해설 FROM Employee E.. 2024. 1. 30. 이전 1 다음