70-461 Free Dumps Study Materials
Question 5: You develop a Microsoft SQL Server database for an order processing system that contains a
table named OrderCountSummary, as shown in the first exhibit. (Click the Exhibit tab.)
The table stores the names of vendors and the number of orders submitted by each vendor for each
food category: Dairy, Meat, Poultry, Seafood, and Vegetarian.
You need to generate a report that displays the total number of orders placed for each food category,
as shown in the following table.
Which four Transact-SQL segments should you use to develop the solution? To answer, move the
appropriate Transact-SQL segments from the list of Transact-SQL segments to the answer area and
arrange them in the correct order.
Correct Answer:Explanation:
You can use the PIVOT and UNPIVOT relational operators to change a table-valued expression into
another table. PIVOT rotates a table-valued expression by turning the unique values from one column
in the expression into multiple columns in the output, and performs aggregations where they are
required on any remaining column values that are wanted in the final output. UNPIVOT performs the
opposite operation to PIVOT by rotating columns of a table-valued expression into column values.
References:
https://docs.microsoft.com/en-us/sql/t-sql/queries/from-using-pivot-and-unpivot