Write a SQL query to identify the top 3 transactions per client per month using window functions.
Use the available client and transaction data. Rank higher transaction amounts first, breaking ties by earlier transaction timestamp and then lower transaction ID.
client_id, client_name, transaction_month, transaction_id, amount, and transaction_rank.client_id, transaction_month, and transaction_rank ascending.| Column | Type | Description |
|---|---|---|
| client_idPK | INT | Unique client identifier |
| client_name | VARCHAR(150) | Client display name |
| segment | VARCHAR(50) | Client business segment |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| client_id | INT | Client associated with the transaction |
| transaction_timestamp | TIMESTAMP | Timestamp when the transaction occurred |
| amount | NUMERIC(14,2) | Transaction amount |