Orders in progress: 'Москва', week of October 1, 2025
Instructions
A delivery interval runs from created_at to delivered_at. Take the 'delivered' deliveries of restaurants in the city 'Москва' created from October 1, 2025 to October 7, 2025 inclusive and merge their overlapping intervals (touching also merges: one delivery created exactly at the moment another is handed over) into periods during which the city had at least one such order in progress. For each period, output busy_from and busy_to (its start and end), orders_cnt (the number of deliveries in it) and busy_minutes (the length of the period in minutes, rounded to 1 decimal place). Sort by busy_from.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
deliveries.→restaurant_id restaurants.id - N:1Many-to-one
deliveries.→customer_id customers.id - N:1Many-to-one
deliveries.→courier_id couriers.id
Table data
Select a table in the diagram or list to view its rows.