Write a SQL query utilizing window functions to find the top three highest-value transactions per department for each month.
Use the transactions table. Include rows with non-null department, transaction date, and amount. Ties are resolved by the smaller transaction ID.
month_start, department, transaction_id, transaction_date, amount, and transaction_rank.month_start, department, transaction_rank, and transaction_id.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| department | VARCHAR(100) | Department responsible for the transaction |
| transaction_date | DATE | Date on which the transaction occurred |
| amount | NUMERIC(12,2) | Transaction value |