Reviewed by Aditya Kumar Β· Last reviewed 2026-03-24
**Group by business key, HAVING COUNT(*) > 1.** Full duplicate rows: ROW_NUMBER() OVER (PARTITION BY col1, col2) and filter rn > 1. SELECT col1, col2, COUNT(*) FROM t GROUP BY col1, col2 HAVING COUNT(*) > 1; SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY col1, col2...
Group by business key, HAVING COUNT(*) > 1. Full duplicate rows: ROW_NUMBER() OVER (PARTITION BY col1, col2) and filter rn > 1.
SELECT col1, col2, COUNT() FROM t GROUP BY col1, col2 HAVING COUNT() > 1;
SELECT FROM (SELECT , ROW_NUMBER() OVER (PARTITION BY col1, col2 ORDER BY id) rn FROM t) WHERE rn > 1;
Red Flag: Undefined 'duplicate' (key vs full row). Pro-Move: 'We define business key in data contract; index it for fast dup check.'
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.