SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Show Salary Difference Between Current and Next Higher Salary

Build mastery in Ranking Nth Value with this scenario-based SQL challenge and live execution support.

Problem Statement

For each employee (ordered by employee_id), show their salary, the next employee's salary, and the difference. Order by employee_id. Show employee_id, first_name, salary, next_employee_salary, salary_difference (next − current).

Relevant Tables

employees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: