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
SQL for Staffing Performance Analysis
00:00
5 left

SQL for Staffing Performance Analysis

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze staffing performance by site, date, and shift, including joins across staffing, schedules, and attendance tables.

Use schedules as the required shift-level grain and analyze dates from 2025-06-01 through 2025-06-03. Include shifts without staffing records and calculate staffing fill and attendance rates.

Output

  1. One row per site, work date, and shift within the date range
  2. Columns: site_name, work_date, shift, scheduled_headcount, staffed_count, attended_count, fill_rate_pct, attendance_rate_pct
  3. Sort by site_name, work_date, and shift ascending

Schema

schedules
ColumnTypeDescription
schedule_idPKINTUnique scheduled shift identifier
site_nameVARCHAR(100)Delaware Staffing client site
work_dateDATEDate of the scheduled shift
shiftVARCHAR(20)Shift label
scheduled_headcountINTNumber of workers requested for the shift
staffing
ColumnTypeDescription
staffing_idPKINTUnique staffing assignment identifier
schedule_idINTScheduled shift receiving the assignment
worker_idVARCHAR(20)Assigned worker identifier
assignment_statusVARCHAR(20)Assignment state
attendance
ColumnTypeDescription
attendance_idPKINTUnique attendance record identifier
schedule_idINTScheduled shift associated with attendance
worker_idVARCHAR(20)Worker whose attendance was recorded
attendance_statusVARCHAR(20)Attendance outcome
Tablesschedulesstaffingattendance
Interviewer

Your question is SQL for Staffing Performance Analysis. Start with the requirements and the three 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.