Interview practice question
Latest version from a change log
Data Engineering · SQL · Intermediate
A source sends full row snapshots on every change into an append-only table. How do you get the current state of each record, including deleted ones being removed?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Use ROW_NUMBER per key ordered by change time descending.
- Keep the latest row per key.
- Exclude keys whose latest row is a delete flag.
- Add a tie-breaker like sequence number.
- Materialize it incrementally for large tables.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.