Immediate Food Delivery I

2pts
Door Dash

Problem Statement

Logistics teams at DoorDash categorize orders based on how quickly the customer wants their food. If the customer's preferred delivery date is the same as the order date, the order is called immediate; otherwise, it is called scheduled.

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

Rules:

  • Percentage = (Count of Immediate Orders / Total Orders) * 100.
  • Round the result to exactly 2 decimal places.
  • The output should contain a single column: immediate_percentage.
  • Results must be returned as a single row.
Tests your understanding of
Basic SQL, Filtering, Aggregation, Rounding and Math Functions

Input Tables

delivery
delivery_id(INTEGER)customer_id(INTEGER)order_date(DATE)customer_pref_delivery_date(DATE)
112024-08-012024-08-01
222024-08-022024-08-05
312024-08-112024-08-12
432024-08-242024-08-24
532024-08-212024-08-22
622024-08-112024-08-13

Expected Output

immediate_percentage(FLOAT)
33.33

Tags

EasyBasic SQLFilteringAggregationRoundingMath Functions
5-10 min
66%

Hints