Private Practice wants to identify operational bottlenecks that take the longest to resolve. Write a PostgreSQL query that summarizes resolved cases by team, calendar week, and bottleneck type, then returns the five groups with the highest average resolution time.
Requirements
- Join
operational_cases to teams and group results by team, week, and bottleneck type.
- Include only resolved cases with non-null timestamps and bottleneck types.
- Calculate average resolution time in hours and the number of resolved cases in each group.
- Return the five highest averages, using a deterministic tie-breaker after sorting by average resolution time descending.
Representative Data