Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the SaleCo snowflake schema on p. 603 of the textbook (Figure 13.21), what is the SQL statement to list the total sales by region

image text in transcribedUsing the SaleCo snowflake schema on p. 603 of the textbook (Figure 13.21), what is the SQL statement to list the total sales by region and customer, with subtotals by region and a grand total for all sales? (Use the ROLLUP command.)

FIGURE 13.21 CUBE EXTENSION Oracle SQL*Plus File Edit Search Options Help SQL> SELECT TM MONTH, P CODE, SUM(SALE_UNITS SALE_PRICE) AS TOTSALES 2 FROM 3 GROUP BY CUBE (TMMONTH, P_CODE) 4 ORDER BY TM MONTH, P CODE; DWDAYSALESFACT NATURAL JOIN DWPRODUCT NATURAL JOIN DWTIME TM MONTH P CODE TOTSALES 9 13-02/P2 9 1546-002 9 2232/QTY 9 2238/QPD 9 23109-HB 9 54778-2T 9 89-WRE-Q 9 PUC23DRT 9 SM-18277 134.91 79.9 109.92 77.9 59.7 39.92 256.99 99.79 20.97 WR3 1239.85 104.93 109.92 39.8 19.96 256.99 99.79 20.97 359.85 1012.21 9.84 79.9 219.84 77.9 99.5 59.88 513.98 199.58 41.94 719.7 2252.06 10 13-02/P2 10 2232/QTY 10 23109-HB 10 54778-2T 10 89-WRE-Q 10 PUC23DRT 10 SM-18277 10 WR3/TT3 10 Subtotals by month 1546-Q02 2232/QTY 2238/QPD 23189-HB 54778-2T 89-WRE- PUC23DRT SM-18277 WR3/TT3 Subtotals by product Grand total for all products and months 31 rous selected

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

Students also viewed these Databases questions