Scenario SQL Question
Complex Nested Subquery Analysis
Build mastery in Subqueries with this scenario-based SQL challenge and live execution support.
Problem Statement
Find employees who earn strictly more than the AVG salary of employees who work in departments containing more than 2 employees. Use a 3-level nested subquery: innermost finds 'big' department ids, the middle one averages over them, the outer compares each row. Return employee_id, first_name, last_name, salary, department_name — ordered by salary DESC, employee_id.
Relevant Tables
employeesdepartments
SQL Concepts Used in This Scenario
Strengthen your understanding with these targeted learning topics: