Write a SQL query to calculate monthly recruiting, training, and production KPIs by district at Colonial Life & Accident Insurance, including joins across agent, activity, and performance tables.
Use the supplied tables and data. Include months represented by either activities or performance records, preserve agents without matching records, and treat missing production amounts as zero for totals.
Output
- One row per district and calendar month
- Columns:
district, month, recruited_agents, training_completions, production_agents, total_premium, and average_premium
- Include districts with no matching activity or performance for a month, display missing districts as
Unassigned, and order by district then month