Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL for SLA Breach Drivers
00:00
5 left

SQL for SLA Breach Drivers

HardSQL · PostgreSQL

Problem

Write a SQL query to track weekly operational performance by region at Binance, joining orders, support tickets, and refunds to identify the top drivers of SLA breaches.

Count a breach when the relevant completion or response timestamp is later than its SLA due timestamp. Use each table's operational timestamp to assign its week; unmatched support tickets and refunds should not contribute to a region.

Output

  1. One row per region and week, with week_start, operational volumes, breach counts, total_sla_breaches, top_driver, prior_week_breaches, and breach_change_pct.
  2. Include regions and weeks represented by any matched operational record. Order by region, then week_start.

Schema

orders
ColumnTypeDescription
order_idPKINTUnique Binance order identifier
regionVARCHAR(20)Operational region
created_atTIMESTAMPOrder creation timestamp
sla_due_atTIMESTAMPOrder fulfillment SLA deadline
fulfilled_atTIMESTAMPActual fulfillment timestamp
support_tickets
ColumnTypeDescription
ticket_idPKINTUnique support ticket identifier
order_idINTRelated order identifier
opened_atTIMESTAMPTicket opening timestamp
response_due_atTIMESTAMPFirst-response SLA deadline
first_response_atTIMESTAMPActual first-response timestamp
refunds
ColumnTypeDescription
refund_idPKINTUnique refund identifier
order_idINTRelated order identifier
requested_atTIMESTAMPRefund request timestamp
refund_due_atTIMESTAMPRefund processing SLA deadline
processed_atTIMESTAMPActual refund processing timestamp
Tablesorderssupport_ticketsrefunds
Interviewer

Your question is SQL for SLA Breach Drivers. 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.