Q1: 1. How would you use GROUPING SETS to produce the same results as the following GROUP BY CUBE? SELECT state, productID, SUM(volume) FROM sales GROUP BY CUBE (state, productID) ORDER BY state, productID 2. How would you show the sub totals for each week, for each state, and for each product? (No other totals or grand totals are required.) Suppose the table structure is TABLE sales (productID VARCHAR, state CHAR(2), week DATE, volume INT) 3. Discuss the utility of grouping and group_id functions Q2: Describe below how this code will work: SELECT dt, region, revenue, count(*) OVER (twdw) AS moving_count, avg(revenue) OVER (twdw) AS moving_average FROM moving_average_data mad WINDOW twdw AS (PARTITION BY region ORDER BY dt RANGE BETWEEN ‘7 days’::interval PRECEDING AND ‘0 days’::interval FOLLOWING ORDER BY region, dt

Looking for solution of this Assignment?


We deliver quality original papers

Our experts write quality original papers using academic databases.We dont use AI in our work. We refund your money if AI is detected  

Free revisions

We offer our clients multiple free revisions just to ensure you get what you want.

Discounted prices

All our prices are discounted which makes it affordable to you. Use code FIRST15 to get your discount

100% originality

We deliver papers that are written from scratch to deliver 100% originality. Our papers are free from plagiarism and NO similarity.We have ZERO TOLERANCE TO USE OF AI

On-time delivery

We will deliver your paper on time even on short notice or  short deadline, overnight essay or even an urgent essay