PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/DoorDash

Measure Daily Late-Order Rates by Delivery Zone

Last updated: Jul 9, 2026

Quick Overview

Write a PostgreSQL query for a clearly specified delivery dataset and report daily late-order rates by delivery zone. The practice prompt tests eligibility filtering, timestamp semantics, grouping, precision, and deterministic output requirements.

  • medium
  • DoorDash
  • Data Manipulation (SQL/Python)
  • Data Scientist

Measure Daily Late-Order Rates by Delivery Zone

Company: DoorDash

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Technical Screen

The original interview report identified a late-order SQL exercise but did not preserve its exact schema. The following is a self-contained practice reconstruction of that topic. You have a PostgreSQL table: ```text orders ------ order_id BIGINT PRIMARY KEY created_at TIMESTAMPTZ NOT NULL promised_delivery_at TIMESTAMPTZ NOT NULL delivered_at TIMESTAMPTZ NULL status TEXT NOT NULL -- 'completed', 'cancelled', or 'failed' delivery_zone TEXT NOT NULL -- non-empty delivery market zone ``` Write one PostgreSQL query that produces one row for every UTC calendar date and delivery zone that has at least one eligible order. An eligible order has `status = 'completed'` and a non-null `delivered_at`. Exclude completed rows whose `delivered_at` is null; exclude all cancelled and failed rows. The three grouping/comparison fields `created_at`, `promised_delivery_at`, and `delivery_zone` are guaranteed non-null, and `delivery_zone` is guaranteed non-empty, so no additional null or unknown-zone bucket is needed. Return these columns: - `order_date`: the UTC calendar date obtained from the instant in `created_at`, regardless of the timezone offset originally used to write that value - `delivery_zone` - `completed_orders`: number of eligible orders in the group - `late_orders`: number of eligible orders where `delivered_at > promised_delivery_at` - `late_order_rate`: `late_orders / completed_orders` as a decimal between 0 and 1 - `previous_date_late_order_rate`: the late-order rate for the preceding available `order_date` in the same zone, or `NULL` for the zone's first date - `late_order_rate_change`: current rate minus `previous_date_late_order_rate`, or `NULL` when there is no previous rate An order delivered exactly at its promised time is on time. Preserve full numeric precision; do not format the rates as strings or percentages. Order the final result by `order_date` ascending and `delivery_zone` ascending.

Quick Answer: Write a PostgreSQL query for a clearly specified delivery dataset and report daily late-order rates by delivery zone. The practice prompt tests eligibility filtering, timestamp semantics, grouping, precision, and deterministic output requirements.

Related Interview Questions

  • Calculate Order Request Metrics - DoorDash (hard)
  • Compute rolling cold-delivery rates with windows - DoorDash (medium)
  • Write SQL for percent and window changes - DoorDash (medium)
  • Model schema and query new-market readiness - DoorDash (medium)
  • Write SQL for cold-complaint diagnostics with LAG/QUALIFY - DoorDash (medium)
|Home/Data Manipulation (SQL/Python)/DoorDash

Measure Daily Late-Order Rates by Delivery Zone

DoorDash logo
DoorDash
May 7, 2026, 12:00 AM
mediumData ScientistTechnical ScreenData Manipulation (SQL/Python)
0
0

The original interview report identified a late-order SQL exercise but did not preserve its exact schema. The following is a self-contained practice reconstruction of that topic.

You have a PostgreSQL table:

orders
------
order_id              BIGINT       PRIMARY KEY
created_at            TIMESTAMPTZ  NOT NULL
promised_delivery_at  TIMESTAMPTZ  NOT NULL
delivered_at          TIMESTAMPTZ  NULL
status                 TEXT         NOT NULL  -- 'completed', 'cancelled', or 'failed'
delivery_zone          TEXT         NOT NULL  -- non-empty delivery market zone

Write one PostgreSQL query that produces one row for every UTC calendar date and delivery zone that has at least one eligible order. An eligible order has status = 'completed' and a non-null delivered_at. Exclude completed rows whose delivered_at is null; exclude all cancelled and failed rows. The three grouping/comparison fields created_at, promised_delivery_at, and delivery_zone are guaranteed non-null, and delivery_zone is guaranteed non-empty, so no additional null or unknown-zone bucket is needed.

Return these columns:

  • order_date : the UTC calendar date obtained from the instant in created_at , regardless of the timezone offset originally used to write that value
  • delivery_zone
  • completed_orders : number of eligible orders in the group
  • late_orders : number of eligible orders where delivered_at > promised_delivery_at
  • late_order_rate : late_orders / completed_orders as a decimal between 0 and 1
  • previous_date_late_order_rate : the late-order rate for the preceding available order_date in the same zone, or NULL for the zone's first date
  • late_order_rate_change : current rate minus previous_date_late_order_rate , or NULL when there is no previous rate

An order delivered exactly at its promised time is on time. Preserve full numeric precision; do not format the rates as strings or percentages. Order the final result by order_date ascending and delivery_zone ascending.

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More DoorDash•More Data Scientist•DoorDash Data Scientist•DoorDash Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.