Zomato operations team wants to optimize delivery partner allocation by identifying peak demand periods. For each city, find the 1-hour window (e.g., 13:00 to 14:00) that has the highest number of orders.
Write an SQL query to determine the peak hour for every city in the dataset.
Rules:
- The peak hour is defined as the starting hour of the 60-minute window (e.g., if the hour is 18, it represents the window 18:00:00 to 18:59:59).
- If there is a tie for the peak hour in a city, return the earliest hour.
- Output columns: city_id, peak_hour, order_count.
- Results should be ordered by city_id in ascending order.
Table Schema:
- Cities: Mapping of city IDs to city names.
- Orders: Detailed records of every order placed on the platform.