Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Track Agency Utilization Query
00:00
5 left

Track Agency Utilization Query

MediumSQL · PostgreSQL

Problem

Omnicom Health operations leaders need a weekly view of team utilization across agency staff. Write a PostgreSQL query using the capacity and time-entry data below.

Requirements

  1. Return one row per team and capacity week from January 6 through January 19, 2025.
  2. Calculate total logged hours and total available hours for each team and week. Include weeks with capacity but no time entries.
  3. Calculate utilization_rate as logged hours divided by available hours, expressed as a percentage rounded to two decimals. Return 0.00 when the available-hours total is zero.
  4. Order results by team name and week start.

Schema

teams
ColumnTypeDescription
team_idPKINTPrimary key for an agency team
team_nameVARCHAR(100)Agency team name
employees
ColumnTypeDescription
employee_idPKINTPrimary key for an employee
employee_nameVARCHAR(100)Employee's name
team_idINTTeam assigned to the employee
roleVARCHAR(80)Employee's agency role
weekly_capacity
ColumnTypeDescription
employee_idPKINTEmployee with planned weekly capacity
week_startPKDATEMonday starting the capacity week
available_hoursNUMERIC(6,2)Hours available to be scheduled
time_entries
ColumnTypeDescription
entry_idPKINTPrimary key for a time entry
employee_idINTEmployee who logged the hours
entry_dateDATEDate the work was logged
hoursNUMERIC(6,2)Hours logged, possibly missing
Tablesteamsemployeesweekly_capacitytime_entries
Interviewer

Your question is Track Agency Utilization Query. Start with the requirements and the four tables in the Question tab.

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.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.