By Michael Nocito, data analyst · Published August 7, 2026

By the end of this page you can check any table for duplicate rows, list every copy, and mark which one to keep, all with queries you understand. You will also know the step that comes before any query: deciding what "duplicate" means for this table, because two rows can match on everything or on one column, and those are different problems with different fixes. It is about twenty minutes.

Here is what to actually do with it. On the next table you are handed, run one comparison before anything else: COUNT(*) against COUNT(DISTINCT key). If the two numbers differ, the table has duplicates, and now you know before your first report does.

The short version: group by the columns that define a duplicate, keep the groups where COUNT(*) is above one, and mark extras with ROW_NUMBER instead of deleting them.

One picture carries the whole method. Rows that share a key collapse into buckets, and the buckets holding more than one row are your duplicates.