SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Top Earner Per Department (ROW_NUMBER = 1)

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

Problem Statement

Find the single highest-paid employee in each department (ties broken by employee_id). Use ROW_NUMBER in a CTE and filter to rn = 1. Return department_name, first_name, last_name, salary — ordered by department_name.

Relevant Tables

employeesdepartments

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: