Write a query utilizing window functions such as ROW_NUMBER or DENSE_RANK to identify duplicate records in a dataset.
Treat records as duplicates when all columns except record_id have identical values. Return every record belonging to a duplicate group, including its occurrence number and total duplicate count.
record_id, duplicate-defining columns, duplicate_sequence, and duplicate_count.record_id ascending.| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique record identifier |
| customer_email | VARCHAR(255) | Customer email associated with the record |
| event_type | VARCHAR(50) | Type of recorded event |
| event_date | DATE | Date when the event occurred |
| amount | DECIMAL(10,2) | Amount associated with the event |