PIVOT and UNPIVOT Operations Quiz

5 questions Pass: 70% +25 pts (50 with Pro)

Quiz covering Advanced Query Techniques

What you'll be asked

  1. Which SQL clause is primarily used to rotate data from a rows-based format into a columns-based format?
  2. When using the PIVOT operator, what happens to columns that are not specified in the PIVOT clause or the aggregate function?
  3. What is the primary requirement for the input data when performing an UNPIVOT operation?
  4. If you have a table with columns 'Year', 'Q1', 'Q2', 'Q3', and 'Q4', and you want to transform it so that 'Q1'-'Q4' become rows under a 'Quarter' column, which operation should you use?
  5. In a PIVOT operation, what occurs if the source data contains multiple values for the same intersection of the grouping column and the pivoted column?

Answers and explanations come after you submit.