Business Context
Publicis Commerce analysts need a quarterly view of which catalog products generated the highest unit sales. For this exercise, use a reporting date of 2025-08-15, making the last quarter 2025-04-01 through 2025-06-30.
Task
Write a PostgreSQL query to return the top 10 products by sales volume during the last quarter.
Requirements
- Include only orders with
status = 'completed'.
- Include orders on or after
2025-04-01 and before 2025-07-01.
- Calculate sales volume as the total ordered
quantity for each product.
- Return
product_id, product_name, and sales_volume, ordered from highest to lowest volume. Use product_id as a deterministic tie-breaker and return at most 10 rows.