Write a SQL query to calculate monthly SLA attainment by team, including total tickets, on-time resolution rate, and month-over-month change.
Use the provided ticket and team data. Treat a ticket as on time only when it has a resolution timestamp at or before its SLA due timestamp. Tickets without a resolution timestamp are not on time.
team_name, month, total_tickets, on_time_resolution_rate, and month_over_month_change.NULL change. Order by team name, then month.| Column | Type | Description |
|---|---|---|
| team_idPK | INT | Unique team identifier |
| team_name | VARCHAR(100) | Team name |
| Column | Type | Description |
|---|---|---|
| ticket_idPK | INT | Unique ticket identifier |
| team_id | INT | Assigned team identifier |
| created_at | TIMESTAMP | Ticket creation timestamp |
| sla_due_at | TIMESTAMP | SLA deadline timestamp |
| resolved_at | TIMESTAMP | Ticket resolution timestamp |