Periods without 'scooter' deliveries of 3+ days: 'Казань'
Level: SeniorTopic: Gaps and islands, sessions200 XP
Instructions
A quiet period is an unbroken run of days of 2025 (from January 1 to December 31 inclusive) on which couriers of the city 'Казань' with vehicle 'scooter' handed over no delivery (the handover day is by delivered_at; delivered_at is empty for deliveries not handed over). A quiet period may start on January 1 or end on December 31. Find all quiet periods of at least 3 days. Output quiet_from and quiet_to (the first and last day of the period) and quiet_days (the number of days in it). Sort by quiet_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
Exactly oneZero or oneZero or more
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
PostgreSQL
Select a table in the diagram or list to view its rows.