Back to problems

Compute rolling cold-delivery rates with windows

SQL · DoorDash · Medium

You are working on a PostgreSQL data-analysis task for a food-delivery marketplace. The schema is: Sample rows are given below. Treat "today" as 2025-03-08, so the trailing seven days span 2025-03-02 through 2025-03-08, endpoints included. A delivery counts as cold when the food temperature recorded at drop-off satisfies food_temp_c < 40, or when a complaint of type cold_food was logged after drop-off but no more than two hours past dropoff_ts. Even if both conditions hold,…

Checking your access…