Given a table of credit card transactions, write a query to identify duplicate charges that occurred within 5 minutes of each other for the same account and amount.
Return each later charge together with the earlier charge it duplicates. Ignore rows with a missing account or amount.
transaction_id, account_id, amount, charge_time, previous_transaction_id, previous_charge_timeaccount_id, charge_time, then transaction_id| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| account_id | VARCHAR(20) | Credit card account identifier |
| amount | DECIMAL(10,2) | Charged transaction amount |
| charge_time | TIMESTAMPTZ | Timestamp when the charge occurred |