Restaurant days without orders: 'Москва', Sep 2025
Instructions
A restaurant's empty day is a day on which none of its deliveries was created (by created_at), in any status. For each restaurant in the city 'Москва', count over the days of September 2025 (from September 1, 2025 to September 30, 2025 inclusive): empty_days (the number of empty days) and longest_empty_run (the length of the longest run of consecutive empty days within the month). Do not output restaurants with no empty days. Output restaurant_id, empty_days, longest_empty_run. Sort by longest_empty_run descending, then empty_days descending, then restaurant_id ascending.
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.