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 Operational Trend Analysis
00:00
5 left

SQL for Operational Trend Analysis

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze operational performance by joining transactions, customers, and support tickets, then aggregate by week to identify trends in volume, resolution time, and failure rate.

Use the provided tables and include weeks represented by either transactions or support tickets. Exclude unresolved tickets from average resolution time, but retain their week in the output.

Output

  1. One row per week, with week_start, transaction_volume, ticket_volume, avg_resolution_hours, and failure_rate_pct.
  2. Include weeks with only transactions or only tickets, use zero for missing volumes and failure rates, and sort by week_start ascending.

Schema

customers
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(100)Customer display name
segmentVARCHAR(30)Customer business segment
transactions
ColumnTypeDescription
transaction_idPKINTUnique transaction identifier
customer_idINTCustomer associated with the transaction
transaction_atTIMESTAMPTransaction timestamp
statusVARCHAR(20)Transaction processing status
amountNUMERIC(12,2)Transaction amount
support_tickets
ColumnTypeDescription
ticket_idPKINTUnique support ticket identifier
customer_idINTCustomer associated with the ticket
created_atTIMESTAMPTicket creation timestamp
resolved_atTIMESTAMPTicket resolution timestamp
issue_typeVARCHAR(40)Support issue category
Tablestransactionscustomerssupport_tickets
Interviewer

Your question is SQL for Operational Trend 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.