A retail analyst wants to rank products by sales within each…
A retail analyst wants to rank products by sales within each category and writes: SELECT category, product_name, SUM(sales) AS total_sales, ROW_NUMBER() OVER (PARTITION BY category ORDER BY SUM(sales) DESC) AS product_rank FROM sales GROUP BY category, product_name; What does product_rank show? OPTIONS:A. The overall rank of products across all categoriesB. The sequential ranking of products within each category, with no tiesC. The cumulative sales of products within each categoryD. The difference between the top product and the current product in each category ANSWER:B EXPLANATION:ROW_NUMBER() assigns a unique sequential rank within each category. Unlike RANK(), it doesn’t allow ties.