RANK || DENSE_RANK || MySQL
Intuition\n\n\n# Approach\n\n\n# Complexity\n- Time complexity:\nBeats 93.18% of users with MySQL\n\n- Space complexity:\n\n\n# Code\n\n# Write your MySQL query
# Intuition\n\n\n# Approach\n\n\n# Complexity\n- Time complexity:\nBeats 93.18% of users with MySQL\n\n- Space complexity:\n\n\n# Code\n```\n# Write your MySQL query statement below\nSELECT Department, Employee, Salary \nFROM\n(SELECT e.name as Employee, d.name AS Department, e.salary AS Salary,\nDENSE_RANK() OVER(PARTITION BY departmentId ORDER BY Salary DESC) AS ranking\nFROM Employee AS e\nLEFT JOIN Department AS d\nON e.departmentId = d.id) AS r\nWHERE ranking = 1\n\n\n```
['MySQL']