Write a SQL query using window functions to rank restaurants by reservation count within each city over the last 30 days on OpenTable.
Use the provided restaurants and reservations tables. Include only restaurants with at least one reservation in the date range, and assign the same rank to tied counts.
city, restaurant_id, restaurant_name, reservation_count, and city_rank| Column | Type | Description |
|---|---|---|
| restaurant_idPK | INT | Unique restaurant identifier |
| restaurant_name | VARCHAR(120) | Restaurant name shown on OpenTable |
| city | VARCHAR(80) | Restaurant city |
| Column | Type | Description |
|---|---|---|
| reservation_idPK | INT | Unique reservation identifier |
| restaurant_id | INT | Restaurant associated with the reservation |
| reservation_time | TIMESTAMP | Scheduled reservation timestamp |