RienSQL
TASK #160 · Medium · Delivery Hero

Top-5 Customers in Last 30 Days

Your brief
Assume today is March 31, 2024. Treat "the last 30 days" as the range from March 2, 2024 to March 31, 2024 inclusive.

Write a query that returns customer_name and order_count for the five customers with the most orders in that period. Sort the result by order_count descending. Test data excludes ties inside the top-5.
Expected columnscustomer_name order_countDelivery Hero
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
citiescity_id, city_name, country
customerscustomer_id, name, city_id
restaurantsrestaurant_id, name, city_id
ordersorder_id, customer_id, restaurant_id, order_placed, order_delivered
order_itemsitem_id, order_id, product_name