GROUPING SETS

GROUPING SETS

Assignment#1.                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.                                                                                           Assignmemt#2.                         Chapter 12 – From the chapter reading, we learned that e-mail is a major area of focus for information governance (IG) efforts, and has become the most common business software application and the backbone of business communications today.  In addition, the authors provided details to support their position by providing 2013 survey results from 2,400 corporate e-mail users from a global perspective.  The results indicated that two-thirds of the respondents stated that e-mail was their favorite form of business communication which surpassed not only social media but also telephone and in-person contact.

Q1: With this detail in mind, briefly state why the e-Mail has become a critical component for IG implementation?                                                        Assignment#3.                                        Chapter 13 – According to Franks and Smallwood (2013), information has become the lifeblood of every business organization, and that an increasing volume of information today has increased and exchanged through the use of social networks and Web2.0 tools like blogs, microblogs, and wikis.  When looking at social media in the enterprise, there is a notable difference in functionality between e-mail and social media, and has been documented by research – “…that social media differ greatly from e-mail use due to its maturity and stability.” (Franks & Smallwood, 2013).

Q2: Please identify and clearly state what the difference is?