Number people in each department
medium
For employees with a department return the department id, the name and a row number that restarts at 1 in each department, counting from the highest salary (ties broken by employee id). Order by department id, then by that number.
Tables Company
- departmentsid, name, city
- employeesid, name, dept_id, manager_id, title, salary, hire_date, commission
- projectsid, name, dept_id, budget, start_date
- assignmentsemployee_id, project_id, hours
Concepts
- row_number
- partition
Run shows your result on the sample data. Submit also runs the query on 2 other sets of data, so it has to be right in general: with ties, missing values (NULL) and rows that have nothing to join to.
Query
CompanyCtrl or Cmd + Enter runs it
Nothing run yet
Press Run to see your result on the sample data and compare it with the expected output. Submit checks it on the other data too.