
Explanation:
The correct answer is PIVOT.
SELECT *
FROM sales_data
PIVOT (
SUM(amount)
FOR product_category IN ('Electronics', 'Clothing', 'Books')
)
SELECT *
FROM sales_data
PIVOT (
SUM(amount)
FOR product_category IN ('Electronics', 'Clothing', 'Books')
)
This would transform rows with different product categories into columns with aggregated sales amounts.
Ultimate access to all questions.
No comments yet.