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 SLA and Staffing Analysis
00:00
5 left

SQL for SLA and Staffing Analysis

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze operational performance by team, joining service data with staffing data and aggregating SLA attainment by month at Hewlett Packard Enterprise. Use the provided service and staffing tables. Include months represented by service records, even when staffing data is unavailable.

Output

  1. One row per team and calendar month
  2. Columns: team_name, month_start, total_requests, sla_met_requests, sla_attainment_pct, and staffed_agents
  3. Include NULL staffing values when no matching staffing record exists
  4. Order by month_start, then team_name

Schema

service_records
ColumnTypeDescription
service_idPKINTUnique service record identifier
team_nameVARCHAR(100)Operations team responsible for the service record
service_typeVARCHAR(100)Type of service request
resolved_atTIMESTAMPTimestamp when the service request was resolved
sla_metBOOLEANWhether the service request met its SLA
team_staffing
ColumnTypeDescription
staffing_idPKINTUnique staffing record identifier
team_nameVARCHAR(100)Operations team being staffed
month_startDATEFirst day of the staffing month
staffed_agentsINTNumber of staffed agents during the month
Tablesservice_recordsteam_staffing
Interviewer

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