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
Weekly Order Accuracy SQL
00:00
5 left

Weekly Order Accuracy SQL

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze weekly order accuracy and missing-item rates by fulfillment center using orders, order_items, and complaints tables.

Use all available order dates. Treat an order as accurate when it has no complaint. Treat a missing-item rate as missing units divided by ordered units. Label orders without a fulfillment center as Unknown.

Output

  1. One row per calendar week and fulfillment center
  2. Columns: week_start, fulfillment_center, total_orders, accurate_orders, accuracy_rate_pct, total_units, missing_units, and missing_item_rate_pct
  3. Include centers with no complaints and avoid counting an order or item more than once
  4. Sort by week_start, then fulfillment_center

Schema

orders
ColumnTypeDescription
order_idPKINTUnique order identifier
order_dateDATEDate the order was placed
fulfillment_centerVARCHAR(50)Fulfillment center handling the order
order_statusVARCHAR(30)Current order status
order_items
ColumnTypeDescription
item_idPKINTUnique order-item identifier
order_idINTOrder containing the item
item_nameVARCHAR(100)CookUnity meal or item name
quantityINTUnits ordered for the item
complaints
ColumnTypeDescription
complaint_idPKINTUnique complaint identifier
order_idINTOrder associated with the complaint
item_idINTSpecific item associated with the complaint, when available
complaint_typeVARCHAR(40)Complaint category
missing_quantityINTUnits reported missing for a missing-item complaint
Tablesordersorder_itemscomplaints
Interviewer

Your question is Weekly Order Accuracy SQL. 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.