Quote:
quote:Originally posted by Jinn
My assignment question is (using the Pubs database):
Create another query but instead of the compute use the Rollup, and then use the CUBE. How are these different from the COMPUTE? Explain your answer.
What I have done is:
SELECT type, AVG (price)
FROM titles
GROUP BY type WITH ROLLUP
SELECT type, AVG (price)
FROM titles
GROUP BY type WITH CUBE
I donât think I did this correctly tho because my results didnât appear to change.
Did I use the Rollup and/or Cube incorrectly?
|
With only a single column in a GROUP BY, Rollup and Cube will show the same thing... try these queries, instead...
SELECT City,State,COUNT(*)
FROM STORES
GROUP BY City,State WITH ROLLUP
SELECT City,State,COUNT(*)
FROM STORES
GROUP BY City,State WITH CUBE
--Jeff Moden