Paytm wants to identify its most active users based on successful transactions completed during the previous calendar month. Write a PostgreSQL query that returns the top 10 users by transaction volume.
status = 'SUCCESS' from the previous calendar month.user_id ascending to make ties deterministic.For this exercise, assume the query runs on 2026-08-29, so the previous calendar month is July 2026.
| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique Paytm user identifier |
| full_name | VARCHAR(100) | User's display name |
| city | VARCHAR(50) | User's registered city |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | BIGINT | Unique transaction identifier |
| user_id | INTEGER | Paytm user who initiated the transaction |
| transaction_timestamp | TIMESTAMPTZ | Time when the transaction was created |
| status | VARCHAR(20) | Transaction processing status |
| amount | NUMERIC(12,2) | Transaction amount in INR |