Courier working-day streaks: 'Москва', Nov 2025
Instructions
A courier's working day is a calendar day on which at least one of the courier's deliveries with status 'delivered' was created (by created_at). A streak is a maximal run of consecutive working days with no missing calendar days (it may consist of a single day). For each courier from the city 'Москва' who had working days in November 2025, from November 1, 2025 to November 30, 2025 inclusive (days outside the month are ignored), output courier_id, work_days (the number of working days), streaks (the number of streaks), avg_streak (the average streak length in days, rounded to 2 decimal places) and longest_streak (the length of the longest streak). Sort by longest_streak descending, then work_days descending, then courier_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.