Keep Most Recent Record
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
- Seniority
- L5
Problem
The users table has duplicate entries from overlapping import jobs, causing downstream fan-outs. Write a query that deduplicates by keeping only the most recently updated record for each user.
Summary
Carbon copies clutter the table. Only the latest matters.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a real database and grades it automatically.