Write a SQL query using advanced window functions such as DENSE_RANK and RANK(). Asked in the Technical Round 2 stage. This was the first SQL question of round 2.
Use the provided employee, department, and assessment score data. Include active employees assigned to a department, treating missing completed scores as zero.
Output
- One row per included employee with
department_name, employee_name, total_points, dense_rank, and rank.
- Rank employees within each department by total points descending. Tied employees share both ranks.
- Order by
department_name, rank, then employee_id.