Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Monthly Team Performance Cost Analysis

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Monthly Team Performance Cost Analysis. Start with the requirements and the three tables on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

You are given operational activity and cost data from a brokerage operations workflow. Write a PostgreSQL query to report monthly performance by team for Gallagher teams, combining activity records with monthly team costs. Your result should show each team and month with total completed volume, average turnaround time in hours, and cost per unit. Teams with activity but no matching monthly cost should still appear, and cost per unit should safely handle missing or zero volume.

Schema

gallagher_activity
ColumnTypeDescription
activity_idPKINTUnique activity record identifier
team_idINTReference to the operations team
case_idVARCHAR(20)Operational case reference
completed_atTIMESTAMPTimestamp when the activity was completed
turnaround_hoursNUMERIC(8,2)Turnaround time in hours
units_processedINTNumber of units completed in the activity
statusVARCHAR(20)Activity status
gallagher_team_costs
ColumnTypeDescription
cost_idPKINTUnique cost record identifier
team_idINTReference to the operations team
cost_monthDATEFirst day of the month for the cost record
monthly_costNUMERIC(12,2)Total monthly operating cost for the team
gallagher_teams
ColumnTypeDescription
team_idPKINTUnique team identifier
team_nameVARCHAR(100)Operations team name
Tablesgallagher_activitygallagher_team_costsgallagher_teams
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results