Reviewed by Aditya Kumar · Last reviewed 2026-03-24
**Window + filter**: SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY key_col ORDER BY ts DESC) rn FROM t) t WHERE rn = 1. Keeps latest per key. **Delta Lake**: MERGE with dedup. **OPTIMIZE + Z-order**: Compaction. **Define**: Key columns; ORDER BY for deterministic...
Window + filter: SELECT FROM (SELECT , ROW_NUMBER() OVER (PARTITION BY key_col ORDER BY ts DESC) rn FROM t) t WHERE rn = 1. Keeps latest per key. Delta Lake: MERGE with dedup. OPTIMIZE + Z-order: Compaction. Define: Key columns; ORDER BY for deterministic winner. Scalability: Partition by key for parallelism.
Red Flag: Undefined order—non-deterministic dedup. Pro-Move: 'We used ROW_NUMBER ORDER BY event_time DESC, id—deterministic; partitioned by dt for incremental processing.'
According to DataEngPrep.tech, this is one of the most frequently asked SQL interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.