Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.