Phd Christine - W11

profileRockstar1

 

• Describe how the following 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

Tags: urgent
  • Not rated

    Discussion

    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 …

  • After readingChapter 11a and Chapter 11b Lecture (see the attachments), “Advanced Analytics -Technology and Tools - Advanced SQL and MADlib”


    SELECT dt, region, revenue,