Amazon Category Managers identify best-performing merchandise across catalog categories. Write a SQL query using the `DENSE_RANK()` window function to find the top-selling product in each product category by total units sold. If multiple products in the same category are tied for the highest units, return all tied products. Return `category_name`, `product_id`, `product_name`, and `total_units_sold`. Order the final output by `category_name ASC`, then `product_id ASC`. Note: Window function support requires DuckDB / full SQL engine capabilities. This question is staged for the upcoming DuckDB browser engine.
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.