Design SQL queries for the supermarket example that will return the information needed to make a table similar to that of Figure 17.10, except that markets are aggregated by state, and time is aggregated by months.

a. Use CUBE or ROLLUP operators.
b. Do not use CUBE or ROLLUP operators.
c. Compute the result table.


a.

SELECT M.Region, T.month, SUM(S.Sales_Amt)

FROM Sales S, Market M, Time T

WHERE S.Market_Id = M.Market_Id AND S.Time_Id = T.Time_Id

GROUP BY CUBE (M.Region, T.month)



b.

SELECT M.Region, T.month, SUM(S.Sales_Amt)

FROM Sales S, Market M, Time T

WHERE S.Market_Id = M.Market_Id AND S.Time_Id = T.Time_Id

GROUP BY M.Region, T.month



SELECT M.Region, SUM(S.Sales_Amt)

FROM Sales S, Market M

WHERE S.Market_Id = M.Market_Id

GROUP BY M.Region



SELECT T.month, SUM(S.Sales_Amt)

FROM Sales S, Time T

WHERE S.Time_Id = T.Time_Id

GROUP BY T.month



SELECT SUM(S.Sales_Amt)

FROM Sales S





c.

Computer Science & Information Technology

You might also like to view...

In the Windows operating systems, deleting a file performs which of the following actions on the data stored on the surface of the medium?

a. Nothing happens to the data at this point. It is simply moved from the original folder to a hidden folder in the Recycle Bin. b. Nothing happens to the data at this point. The allocation marker for the file is simply reset. c. A random deluge of zeroes and ones is copied over the original data. d. The entry for the file is purged from the $MFT metadata file in the file system.

Computer Science & Information Technology

The extension of the file in the accompanying figure is ____.

A. .dir B. .dxr C. .cxt D. .dcr

Computer Science & Information Technology

________ is the cloud service integrated with Excel 2016

Fill in the blank(s) with correct word

Computer Science & Information Technology

What process writes sector markings to a hard drive?

A. Partitioning B. High-level formatting C. Sector provisioning D. Low-level formatting

Computer Science & Information Technology