
Ultimate access to all questions.
Deep dive into the quiz with AI chat providers.
We prepare a focused prompt with your quiz and certificate details so each AI can offer a more tailored, in-depth explanation.
Which SQL keyword can be used to convert a table from a long format to a wide format?
A
TRANSFORM
B
PIVOT
C
SUM
D
CONVERT
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.