Write a SQL query to analyze branch-level transaction volumes, failed transactions, and average turnaround time by month.
Use the provided branch and transaction data. Include only transactions associated with a known branch, and calculate turnaround time from initiation to completion.
branch_code, branch_name, month, total_transactions, failed_transactions, and avg_turnaround_minutesbranch_code, then month ascending| Column | Type | Description |
|---|---|---|
| branch_codePK | INT | Unique branch identifier |
| branch_name | VARCHAR(100) | Official branch name |
| city | VARCHAR(80) | City where the branch operates |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| branch_id | INT | Branch that processed the transaction |
| status | VARCHAR(20) | Transaction processing status |
| initiated_at | TIMESTAMP | Transaction initiation timestamp |
| completed_at | TIMESTAMP | Transaction completion timestamp |