SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Compare Department Salary with Company Average

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

Problem Statement

Compare each department's average salary with the company's overall average. Label the department 'Higher', 'Lower', or 'Same'. Return department_id, department_name, dept_avg_salary, salary_comparison — ordered by department_id.

Relevant Tables

employeesdepartments

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: