Write a query using window functions to identify duplicate records within a municipal transactions table.
Treat records as duplicates when all transaction attributes except transaction_id match, including NULL values. Return only records belonging to duplicate groups.
transaction_id, identifying attributes, duplicate_count, and duplicate_ranktransaction_id within each duplicate group| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique identifier for the transaction record |
| department | VARCHAR(100) | Municipal department responsible for the transaction |
| vendor_id | VARCHAR(30) | Vendor identifier associated with the transaction |
| transaction_date | DATE | Date on which the transaction occurred |
| amount | DECIMAL(12,2) | Transaction amount in U.S. dollars |
| description | VARCHAR(200) | Short description of the transaction |