Scenario SQL Question
Keep Only the Latest Salary Per Employee (Deduplication)
Build mastery in Ctes Window with this scenario-based SQL challenge and live execution support.
Problem Statement
salaries_history holds multiple rows per employee. Keep only the most recent record per employee (latest effective_date). Use ROW_NUMBER. Return employee_id, salary, effective_date — ordered by employee_id.
Relevant Tables
salaries_history
SQL Concepts Used in This Scenario
Strengthen your understanding with these targeted learning topics: