SQL Practice Logo

SQLPractice Online

Scenario SQL Question

RANK vs DENSE_RANK Within Departments

Build mastery in Ctes Window with this scenario-based SQL challenge and live execution support.

Problem Statement

For each department, show every employee's salary RANK and DENSE_RANK (highest salary = rank 1). Return department_name, first_name, last_name, salary, salary_rank, salary_dense_rank — ordered by department_name, salary DESC, employee_id.

Relevant Tables

employeesdepartments

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: