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
Top Suppliers by Fulfillment Speed
00:00
5 left

Top Suppliers by Fulfillment Speed

MediumSQL · PostgreSQL

Problem

Given a complex relational database of parts inventory and supplier lead times, write a query to find the top three suppliers by fulfillment speed using window functions.

Use the provided supplier, parts inventory, and purchase order data. Fulfillment speed is based on completed purchase orders only.

Output

  1. One row per supplier in the top three.
  2. Return supplier_name, avg_fulfillment_days, fulfilled_orders, and fulfillment_rank.
  3. Sort by rank ascending, average fulfillment days ascending, and supplier ID ascending for ties.

Schema

suppliers
ColumnTypeDescription
supplier_idPKINTUnique supplier identifier
supplier_nameVARCHAR(100)Supplier name
contracted_lead_time_daysINTSupplier's contracted lead time in days
parts_inventory
ColumnTypeDescription
part_idPKINTUnique part identifier
part_numberVARCHAR(50)Caterpillar part number
part_descriptionVARCHAR(150)Part description
quantity_on_handINTCurrent inventory quantity
purchase_orders
ColumnTypeDescription
purchase_order_idPKINTUnique purchase order identifier
supplier_idINTSupplier fulfilling the order
part_idINTOrdered inventory part
order_dateDATEDate the purchase order was placed
delivery_dateDATEDate the order was delivered
Tablessuppliersparts_inventorypurchase_orders
Interviewer

Your question is Top Suppliers by Fulfillment Speed. 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.