PracHub
QuestionsLearningGuidesInterview Prep

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.

Last updated: Jul 23, 2026

Loading coding console...

PracHub

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

Product

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

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.

Related Coding 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)