Amazon's retail analytics team reports on fiscal weeks defined in calendar_weeks (week_start to week_end, both inclusive). An order belongs to the week that contains its order date; the time of day does not matter, so an order at 23:30 on week_end still belongs to that week. Only orders with status = 'completed' count. Every week in calendar_weeks must appear, with 0 for weeks that have no completed orders. Write an SQL query that returns week_start, weekly_gmv (the sum of gmv of completed orders) and repeat_buyers (the number of users with at least 2 completed orders in that week). Order the results by week_start ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.