2023 1 How would you use GROUPING SETS to produce the same results as the following GROUP BY CUBE | Assignment Collections
Computer Science 2023 Data Science And Big Data, SQL
2023 1 How would you use GROUPING SETS to produce the same results as the following GROUP BY CUBE | Assignment Collections
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
We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.