Immediate Delivery III

ASKED IN INTERVIEW
2pts
Door Dash

Problem Statement

DoorDash classifies an order as immediate if the customer preferred delivery date is the same as the order date. Otherwise, it is classified as scheduled.

Write an SQL query to find the percentage of immediate orders in the entire table, rounded to 2 decimal places.

Rules:

  • Percentage = (Count of immediate orders / Total count of orders) * 100.
  • Output column: immediate_percentage.
Tests your understanding of
Arithmetic, Filtering and Date Comparison

Input Tables

Delivery
delivery_id(INTEGER)customer_id(INTEGER)order_date(DATE)customer_pref_delivery_date(DATE)
112026-02-012026-02-01
222026-02-022026-02-05
312026-02-012026-02-01
432026-02-032026-02-03
Couriers
courier_id(INTEGER)courier_name(VARCHAR)
101Dasher1
102Dasher2
Restaurants
restaurant_id(INTEGER)cuisine(VARCHAR)
501Italian
502Thai

Expected Output

immediate_percentage(DECIMAL)
75

Tags

EasyASKED IN INTERVIEWArithmeticFilteringDate Comparison
10-15 min
82%

Hints