✅ SQL || Multiple Approaches || Easy to understand
I just found this Blog and Github repository with solutions to Leetcode problems.\nhttps://leet-codes.blogspot.com/2022/10/department-highest-salary.html\nIt ha
I just found this Blog and Github repository with solutions to Leetcode problems.\nhttps://leet-codes.blogspot.com/2022/10/department-highest-salary.html\nIt has solutions to almost every problem on Leetcode, and I recommend checking it out.\nNote: You can bookmark it as a resource, and approach. Other approaches are in above blog\n<br>\n\n```\nSELECT d.name AS Department, e.Employee, e.Salary\nFROM Department d\nLEFT JOIN (\n        SELECT \n            departmentId, \n            salary AS Salary,\n            name AS Employee,\n            DENSE_RANK() OVER (PARTITION BY departmentId ORDER BY salary DESC) AS \'salary_rank\'\n        FROM Employee) e\nON d.id = e.departmentId\nWHERE salary_rank = 1\n```
['MySQL']