Chewy's merchandising team needs a quarterly view of its best-selling products. Assume the reporting quarter is April 1, 2025 through June 30, 2025, inclusive.
Write a PostgreSQL query to identify the top three products by units sold within each product category.
Requirements
- Include only completed orders placed during the reporting quarter.
- Aggregate
quantity by product and category, treating NULL quantities as zero.
- Rank products independently within each category and return only ranks 1 through 3.
- Sort the output by category and sales rank.