SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Employees Earning More Than Their Department Average

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

Problem Statement

Find employees whose salary is strictly greater than the AVERAGE salary of their OWN department. The inner query references the outer row's department_id (correlated). Return employee_id, first_name, last_name, department_name, salary — 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: