Recall & Review
beginner
What does the PIVOT operation do in SQL?
PIVOT turns rows into columns, summarizing data to make it easier to compare values side by side.
Click to reveal answer
beginner
What is the purpose of the UNPIVOT operation in SQL?
UNPIVOT turns columns into rows, helping to normalize data or prepare it for analysis.
Click to reveal answer
intermediate
In a PIVOT operation, what kind of SQL clause is typically used to aggregate data?
An aggregate function like SUM(), COUNT(), or AVG() is used to combine values when turning rows into columns.
Click to reveal answer
beginner
Give a simple example of when you might use UNPIVOT.
If you have sales data with columns for each month, UNPIVOT can turn those month columns into rows with a month name and sales value, making it easier to analyze trends.
Click to reveal answer
beginner
Why is PIVOT useful for reporting?
PIVOT helps create summary tables that show data in a clear, column-based format, making reports easier to read and understand.
Click to reveal answer
What does the PIVOT operation do in SQL?
✗ Incorrect
PIVOT changes rows into columns to summarize data.
Which SQL function is commonly used with PIVOT to summarize data?
✗ Incorrect
SUM() aggregates values when pivoting data.
What is the main use of UNPIVOT in SQL?
✗ Incorrect
UNPIVOT converts columns into rows for easier analysis.
If you have monthly sales as columns, which operation helps to list them as rows?
✗ Incorrect
UNPIVOT turns monthly columns into rows.
Why might you use PIVOT in a report?
✗ Incorrect
PIVOT arranges data in columns for easy comparison.
Explain in your own words what PIVOT and UNPIVOT do in SQL and give a simple example for each.
Think about how data layout changes between rows and columns.
You got /4 concepts.
Why are PIVOT and UNPIVOT useful when working with data? Describe a situation where each would help.
Consider how data presentation affects understanding.
You got /4 concepts.