DATABRICKS-CERTIFIED-DATA-ENGINEER-ASSOCIATE · Question #30
Which of the following SQL keywords can be used to convert a table from a long format to a wide format?
The correct answer is B. PIVOT. PIVOT is the SQL operation used to rotate rows into columns - transforming a long/narrow table (many rows, few columns) into a wide/crosstab table (fewer rows, many columns). For example, pivoting monthly sales rows into a single row per customer with one column per month…
Question
Options
- ATRANSFORM
- BPIVOT
- CSUM
- DCONVERT
- EWHERE
How the community answered
(38 responses)- A3% (1)
- B92% (35)
- E5% (2)
Explanation
PIVOT is the SQL operation used to rotate rows into columns - transforming a long/narrow table (many rows, few columns) into a wide/crosstab table (fewer rows, many columns). For example, pivoting monthly sales rows into a single row per customer with one column per month. TRANSFORM applies a function to elements, SUM is an aggregate function, CONVERT changes data types, and WHERE filters rows - none of these restructure a table from long to wide format.
Topics
Community Discussion
No community discussion yet for this question.