Standout restaurants in each city

MediumDoorDashctesjoinsgroup comparisons· 20 XP

DoorDash's partnerships team wants to thank its busiest restaurants. "Busy" depends on the city, so each restaurant is compared with its own city's average.

Find restaurants whose number of delivered orders is at least twice the average for restaurants in the same city.

Expected output

  • Any row order

Example of the shape (made-up values):

restaurant_id city deliveries
88 Lakeside 61

Hints, the later steps and the answer come with Pro.

Write your query here. Ctrl + Enter submits.