Note: This question is part of a series of questions that use the same or similar answer choices. An
answer choice may be correct for more than one question in the series. Each question is independent
of the other questions in this series. Information and details provided in a question apply only to that
question.
You create a table by running the following Transact-SQL statement:
You are developing a report that displays customer information. The report must contain a grand total column.
You need to write a query that returns the data for the report.
Which Transact-SQL statement should you run?

Explanation:
Calculate aggregate column through AVG function and GROUP BY clause.
Ho do you get a grand total column from E ? answer should be A but the query is wrong
23
0
Agree.
Ref. for GROUPING SETS ()
https://docs.microsoft.com/en-us/sql/t-sql/queries/select-group-by-transact-sql
13
0
I agree with you
2
0
No correct answer
8
0
There should be a SUM() instead of AVG() for “grand total”. The answer A is a better choice in my opinion.
6
1
then there is no written that you should filter by year> = 2014
0
3
LA RESPUESTA QUE MAS SE APROXIMA ES THE —>LETTER A
SELECT CustomerID,AnnualRevenue,address,FirstName,LastName
FROM Q28.customers
GROUP BY GROUPING SETS(
(FirstName,LastName),(address),(CustomerID,AnnualRevenue),(CUSTOMERID)
)
PERO LA RESPUESTA CORRECTA SERIA:
SELECT customerID,SUM(ANNUALREVENUE)
FROM Q28.Customers
GROUP BY GROUPING SETS(customerID,())
1
0
the correct Answer is A, because to get grand you must use Grouping SET.
GROUP BY ()
Specifies the empty group which generates **the grand** total. This is useful as one of the elements of a GROUPING SET. For example, this statement gives the total sales for each country and then gives the grand-total for all countries.
SELECT Country, SUM(Sales) AS TotalSales
FROM Sales
GROUP BY GROUPING SETS ( Country, () );
3
0