SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Rank Employees by Salary (ROW_NUMBER)

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

Problem Statement

Assign a unique row number to every employee ordered by salary descending (ties broken by employee_id). Return first_name, last_name, salary, department_name, row_num — ordered by row_num.

Relevant Tables

employeesdepartments

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: