SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Compare Employee Salary with Previous Employee (by Hire Date)

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

Problem Statement

Write a query to show each employee's name, hire_date, salary, and the previous employee's salary ordered by hire date. Use LAG window function.

Relevant Tables

employees

SQL Concepts Used in This Scenario

Strengthen your understanding with these targeted learning topics: