Write a SQL query to analyze operational performance by team at NiCE, including joins across relevant tables and aggregations for key metrics. Use the provided tables and data to calculate team-level operational results.
team_name, active_agents, total_interactions, resolved_interactions, avg_handle_minutes, and resolution_rate_pct.| Column | Type | Description |
|---|---|---|
| team_idPK | INT | Unique team identifier |
| team_name | VARCHAR(100) | NiCE operational team name |
| region | VARCHAR(50) | Primary operating region |
| Column | Type | Description |
|---|---|---|
| agent_idPK | INT | Unique agent identifier |
| team_id | INT | Assigned operational team |
| agent_name | VARCHAR(100) | Agent display name |
| active | BOOLEAN | Whether the agent is currently active |
| Column | Type | Description |
|---|---|---|
| interaction_idPK | INT | Unique interaction identifier |
| agent_id | INT | Agent handling the interaction |
| occurred_at | TIMESTAMP | Interaction start timestamp |
| status | VARCHAR(30) | Operational status of the interaction |
| handle_minutes | DECIMAL(8,2) | Duration in minutes when available |