78

Rank Employees by Salary

Hardwindow functionRANKPARTITION BY

Problem Description

Write a SQL query to rank employees by salary within each department.

Expected Columns

  • name
  • department
  • salary
  • dept_rank

Example Output

| name | department | salary | dept_rank | |------|------------|--------|-----------| | Karthik Sundaram | Engineering | 95000 | 1 | | Ananya Singh | Engineering | 90000 | 2 | | Aarav Sharma | Engineering | 85000 | 3 | | ... | ... | ... | ... |

Hints

Unlocks after 2 more attempts
Submit your solution to unlock hints
//#78 Rank Employees by Salary
Hard

Loading schema...

Loading editor...

No results yet

Run a query to see results