SQL questions based on DoorDash data schema, python leet code medium
Using the DoorDash-style tables provided, write a PostgreSQL query for Seattle restaurants. Include restaurants without qualifying deliveries and consider only completed orders delivered during the first quarter of 2024.
Output
- One row per Seattle restaurant, with
restaurant_name, completed_delivery_count, and avg_delivery_minutes.
- Sort by completed delivery count descending, then restaurant name ascending.
- Return NULL for the average when no qualifying delivery has a measurable duration.