Orders by day: paid, 21 days from July 16, 2025
Level: Middle100 XP
Instructions
Build a calendar of 21 consecutive days: from July 16, 2025 to August 5, 2025 inclusive. For each day output day (type date) and orders_cnt, the number of orders with status = 'paid' whose orders.created_at falls on that day (from 00:00 inclusive to 24:00 exclusive). Days with no such orders must still be output with orders_cnt = 0. Sort by day ascending.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Exactly oneZero or oneZero or more
Table relationships
- N:1Many-to-one
order_items.→order_id orders.id - N:1Many-to-one
order_items.→product_id products.id - N:1Many-to-one
orders.→customer_id customers.id - N:1Many-to-one
products.→category_id categories.id
Table data
PostgreSQL
Select a table in the diagram or list to view its rows.