RienSQL
TASK #161 · Medium · Delivery Hero

Average Delivery Time per City

Your brief
Delivery time of an order is the difference between order_delivered and order_placed in minutes. The city of an order is the city of the restaurant the order was placed at.

Write a query that returns city_name and avg_minutes — the average delivery time per city, rounded to two decimals. Sort the result by avg_minutes ascending.
Expected columnscity_name avg_minutesDelivery Hero
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
citiescity_id, city_name, country
customerscustomer_id, name, city_id
restaurantsrestaurant_id, name, city_id
ordersorder_id, customer_id, restaurant_id, order_placed, order_delivered
order_itemsitem_id, order_id, product_name