How would you use SQL to identify the top 10 restaurants by revenue in each city?
Assume revenue is the sum of order_total for orders with status = 'completed'. Return only restaurants with completed orders, and use restaurant_id as the tie-breaker.
city_name, restaurant_id, restaurant_name, and total_revenue.| Column | Type | Description |
|---|---|---|
| city_idPK | INT | Unique city identifier |
| city_name | VARCHAR(100) | City name |
| Column | Type | Description |
|---|---|---|
| restaurant_idPK | INT | Unique restaurant identifier |
| restaurant_name | VARCHAR(150) | Restaurant display name |
| city_id | INT | City where the restaurant operates |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| restaurant_id | INT | Restaurant associated with the order |
| order_total | DECIMAL(10,2) | Order amount used to calculate revenue |
| status | VARCHAR(30) | Order fulfillment status |