You run the following Transact-SQL statement:
You use the table to store data about training courses: when they finished the location, and the number of participants in the courses.
You need to display a result set that shows aggregates for all possible combinations of the number of participants.
Which Transact-SQL statement should you run?
A . SELECT CourseID, CourseDate, SUM(NumParticipants)FROM CourseParticipantsGROUP BY CourseID, CourseDate
B . SELECT CourseID, CourseDate, SUM(DISTINCT NumParticipants)FROM CourseParticipantsGROUP BY CourseID, CourseDate
C . SELECT CourseID, CourseDate, SUM(NumParticipants)FROM CourseParticipantsGROUP BY CourseID, CourseDate WITH CUBE
D . SELECT CourseID, CourseDate, SUM(DISTINCT NumParticipants)FROM CourseParticipants GROUP BY CourseID, CourseDate WITH ROLLUP
Answer: C
Explanation:
The WITH CUBE clause causes the query to compute all possible totals
References: https://blogs.msdn.microsoft.com/craigfr/2007/09/27/aggregation-with-cube/
Leave a Reply