Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL for Sellers With Degraded Fulfillment

HardSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL for Sellers With Degraded Fulfillment. Start with the requirements and the three tables on the right.

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.

Problem

Whatnot Operations needs to identify top-performing sellers whose shipping fulfillment has worsened recently. Write a PostgreSQL query comparing the last 30 days with the preceding 30 days, using August 29, 2026 as the reporting date.

Requirements

  1. Calculate each seller's on-time shipping fulfillment rate, where an order is fulfilled when shipped_at is on or before promised_ship_date.
  2. Define top-performing sellers as those with at least 2 preceding-period orders and a preceding fulfillment rate of at least 90%.
  3. Return sellers with at least 2 recent orders whose fulfillment rate declined by at least 15 percentage points.
  4. Return both period rates, order counts, and the decline, ordered by decline descending.

Schema

sellers
ColumnTypeDescription
seller_idPKINTUnique seller identifier
seller_nameVARCHAR(100)Seller display name
orders
ColumnTypeDescription
order_idPKINTUnique order identifier
seller_idINTSeller who created the order
order_dateDATEDate the order was placed
promised_ship_dateDATERequired ship-by date
shipments
ColumnTypeDescription
shipment_idPKINTUnique shipment identifier
order_idINTOrder associated with the shipment
shipped_atDATEActual shipment date
Tablessellersordersshipments
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results