Scenario SQL Question
Salary Comparison Within Departments
Build mastery in Joins with this scenario-based SQL challenge and live execution support.
Problem Statement
For every employee, compute their salary, the department's average salary (rounded 2), and a label: 'Above Average' / 'Below Average' / 'Average'. Return employee_id, first_name, last_name, department_name, salary, avg_salary, salary_comparison — ordered by department_id, salary DESC, employee_id.
Relevant Tables
employeesdepartments
SQL Concepts Used in This Scenario
Strengthen your understanding with these targeted learning topics: