SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Identify Highest and Lowest Salary in Each Department

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

Problem Statement

For each department, label employees whose salary equals the dept MAX as 'Highest', the dept MIN as 'Lowest', everyone else 'N/A'. If a department has only one employee, label that row 'Highest'. Return department_id, employee_id, first_name, last_name, salary, salary_label — ordered by department_id, salary DESC, employee_id.

Relevant Tables

employees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: