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 Weekly Operational Metrics
00:00
5 left

SQL for Weekly Operational Metrics

HardSQL · PostgreSQL

Problem

eBay Operations needs a weekly view of order fulfillment performance across its marketplace operations. Write a PostgreSQL query that combines orders, shipment records, and eBay customer support tickets without double-counting orders that have multiple tickets.

Requirements

  1. Exclude cancelled orders and orders outside January 6 through January 26, 2025.
  2. Group results by the Monday week containing each order date.
  3. Return total orders, gross order value, shipped orders, support ticket count, and the percentage of delivered orders delivered on or before the promised date.
  4. Preserve orders without shipment or support records, and return weeks in chronological order.

Schema

orders
ColumnTypeDescription
order_idPKINTUnique eBay order identifier
buyer_idVARCHAR(20)eBay buyer identifier
order_dateDATEDate the order was placed
promised_dateDATEPromised delivery date
order_amountNUMERIC(10,2)Order value in dollars
order_statusVARCHAR(20)Order lifecycle status
shipments
ColumnTypeDescription
shipment_idPKINTUnique shipment identifier
order_idINTOrder associated with the shipment
shipped_dateDATEDate the shipment left the fulfillment facility
delivered_dateDATEDate delivered to the buyer
shipment_statusVARCHAR(20)Shipment status
carrierVARCHAR(30)Shipping carrier
support_tickets
ColumnTypeDescription
ticket_idPKINTUnique support ticket identifier
order_idINTOrder referenced by the ticket
created_atTIMESTAMPTicket creation timestamp
resolution_statusVARCHAR(20)Ticket resolution status
issue_typeVARCHAR(30)Customer-reported issue category
Tablesordersshipmentssupport_tickets
Interviewer

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