AXA XL wants to compare operational efficiency across teams. Write a PostgreSQL query that joins operational records with customer and performance data, then calculates each team's average efficiency for the last completed quarter and the quarter before it, using July 1, 2026 as the reporting anchor.
Output
- Return one row per team with
team_id, team_name, prior_quarter_efficiency, last_quarter_efficiency, and efficiency_improvement.
- Include only teams with a non-NULL efficiency average in both quarters. NULL efficiency scores are ignored by the averages.
- Treat April through June 2026 as the last completed quarter and January through March 2026 as the prior quarter.
- Sort by
efficiency_improvement descending, then team_id ascending, and return at most 10 teams.