Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for Operational Bottlenecks
00:00
5 left

SQL for Operational Bottlenecks

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze operational performance by joining incident, workflow, and KPI tables to identify the highest-impact bottlenecks.

Use the provided tables to evaluate monthly workflow impact and return only the three highest-impact workflows for each month.

Output

  1. One row per workflow and month, with workflow_id, workflow_name, period_start, incident_count, total_downtime_minutes, avg_severity, sla_gap_pct, throughput_gap_pct, impact_score, previous_month_score, and impact_rank.
  2. Include only the top three workflows per month, ordered by period_start, impact_rank, and workflow_id.

Schema

workflows
ColumnTypeDescription
workflow_idPKINTUnique workflow identifier
workflow_nameVARCHAR(100)Operational workflow name
operational_areaVARCHAR(80)Area responsible for the workflow
incidents
ColumnTypeDescription
incident_idPKINTUnique incident identifier
workflow_idINTAffected workflow
incident_tsTIMESTAMPIncident occurrence timestamp
severityINTIncident severity from 1 to 5
downtime_minutesINTOperational downtime attributed to the incident
statusVARCHAR(20)Incident lifecycle status
kpis
ColumnTypeDescription
kpi_idPKINTUnique KPI record identifier
workflow_idINTMeasured workflow
period_startDATEFirst day of the KPI month
target_sla_pctDECIMAL(5,2)Monthly SLA target percentage
actual_sla_pctDECIMAL(5,2)Monthly achieved SLA percentage
target_throughputINTMonthly throughput target
actual_throughputINTMonthly achieved throughput
Tablesincidentsworkflowskpis
Interviewer

Your question is SQL for Operational Bottlenecks. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.