SQL · Capital One · Medium
An e-commerce dataset records purchases in orders and order_items, and product returns in returns. Write a single SQL query that returns, for each product category, the product with the greatest net revenue during the seven-day reporting window ending on 2025-11-09. The window includes dates from 2025-11-03 through 2025-11-09. Use these rules: Include only orders whose order_date is within 2025-11-03 to 2025-11-09, inclusive. For each product_id, calculate net_units as the…
Checking your access…