
Answer-first summary for fast verification
Answer: SELECT Category, MAX(Price) AS HighestPrice FROM Products GROUP BY Category;
Option A correctly finds the highest priced product in each category. Options B, C, and D either do not calculate the maximum price correctly or do not group by the category correctly.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are working with a warehouse in Fabric that contains a table named 'Products' with columns 'ProductID', 'ProductName', 'Category', and 'Price'. You need to write a SQL query to find the highest priced product in each category. How would you structure this query?
A
SELECT Category, MAX(Price) AS HighestPrice FROM Products GROUP BY Category;
B
SELECT Category, Price AS HighestPrice FROM Products;
C
SELECT Category, MAX(Price) AS HighestPrice FROM Products;
D
SELECT Category, Price AS HighestPrice FROM Products GROUP BY Category;