ROLAPs, Rollups and Cubes: an Introduction to Super Groups CS240A Notes from A Complete Guide to DB2 Universal Database, by Don Chamberlin, Morgan Kaufmann.

Slides:



Advertisements
Similar presentations
CSC 142 G 1 CSC 142 Conditionals [Reading: chapter 5]
Advertisements

Test practice Multiplication. Multiplication 9x2.
Chapter 11 Group Functions
Competency with the Census E. Turner CSU Northridge FOR MORE INFO...
Continuous Surveys: Statistical Challenges and Opportunities Carl Schmertmann Center for Demography & Population Health Florida State University
Lab3 CPIT 440 Data Mining and Warehouse.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 HUMAN CAPITAL.
Chapter 4 Tutorial.
John Blodgett OSEDA, UMC Sept. 16, 2010 / DBRL.  Demographics of Boone and Callaway Counties.ppt
Copyright 2007– WinWare, Inc. Session: How to Utilize the Open Database Architecture of CribMaster Presenter: Phil Stenger.
Database Programming Sections 5– GROUP BY, HAVING clauses, Rollup & Cube Operations, Grouping Set, Set Operations 11/2/10.
Ch. 3 - Atomic Structure II. Masses of Atoms (p.75-80) Mass Number
DATE Making Sense of the Census: One Year On with the CAIRD Project Rob Dymond Mimas Development Officer Census Dissemination Unit Mimas University of.
Liesl Eathington Iowa Community Indicators Program Iowa State University October 2014.
California Water Usage Research Question What factors influence California residence’s daily water usage? Hypotheses H 0 (Null): The independent variables.
Using someone else’s words as your own by: ≈ Directly copying from a book or other work ≈ “Cut and paste” from the Internet Use “quotation marks” around.
SpotFire Instructional ICS 105, Human Computer Interaction Research Group Winter 2002.
U.S. Census Bureau’s Population Estimates Program Victoria Velkoff Population Division U.S. Census Bureau APDU 2010 Annual Conference Public Data 2010:
© T Madas. Fill in this negative multiplication table. [the numbers multiplied are all whole negative & positive numbers]
Ch. 3 - Atomic Structure II. Masses of Atoms (p.75-80)  Mass Number  Isotopes  Relative Atomic Mass  Average Atomic Mass.
Powers and roots. Square each number a) 7 b) 12 c) 20 d) 9 e) 40 a) 49 b) 144 c) 400 d) 81 e) 1600.
Databases. Revision tip: Focus on the things you find difficult first.
1 Population Controls for the American Community Survey Alexa Kennedy-Puthoff Population Division Prepared for the 2009 SDC Annual Training Conference,
2010 Fresno and Bakersfield Population City or County Name % change Fresno City428,000500,00016% Fresno County800,000930, % Bakersfield247,000347,00041%
Current Approaches to Measuring Asset Ownership and Control: MALDIVES Department of National Planning.
DICKINSON, NORTH DAKOTA RETAIL DEVELOPMENT POTENTIAL Prepared for: Roers Development Stark Development Corporation Prepared by:
1 Dissemination of Data in the Demographic Yearbook System: Current approaches and Future Direction Expert Group Meeting to Review the United Nations Demographic.
Objective 3.3 Congressional Representation KQ- How is the # of representative per state determined?
An Overview of Statistics Section 1.1 After you see the slides for each section, do the Try It Yourself problems in your text for that section to see if.
SAN FERNANDO VALLEY CENSUS COUNTY DIVISION AND I-5 CORRIDOR DEMOGRAPHICS San Fernando Valley Economic Research Center Daniel Blake, Director California.
Relational Databases Today we will look at: Different ways of searching a database Creating queries Aggregate Queries More complex queries involving different.
II. Masses of Atoms Mass Number
Multiplication table. x
Anything else? Final Exam Study Guide Quantity Control Microphones
Name……………………………….…. Date…………………… Name…………………. Date…………………… 1.
III. Masses of Atoms (p ) Atomic Mass Mass Number Isotopes
Ch Atomic Structure II. Masses of Atoms (p.30-31) Mass Number
מדינת ישראל הוועדה לאנרגיה אטומית
Chapter 4 Summary Query.
The Big 6 Research Model Step 3: Location and Access
Dots 5 × TABLES MULTIPLICATION.
Dots 5 × TABLES MULTIPLICATION.
III. Masses of Atoms (p ) Atomic Mass Mass Number Isotopes
Dots 2 × TABLES MULTIPLICATION.
III. Masses of Atoms (p ) Atomic Mass Mass Number Isotopes
Dividing Fractions and Mixed Numbers Guided Notes
5 × 7 = × 7 = 70 9 × 7 = CONNECTIONS IN 7 × TABLE
5 × 8 = 40 4 × 8 = 32 9 × 8 = CONNECTIONS IN 8 × TABLE
Dots 3 × TABLES MULTIPLICATION.
Query Functions.
Dots 6 × TABLES MULTIPLICATION.
4 × 6 = 24 8 × 6 = 48 7 × 6 = CONNECTIONS IN 6 × TABLE
5 × 6 = 30 2 × 6 = 12 7 × 6 = CONNECTIONS IN 6 × TABLE
Impact (quantify if possible) :
1: multiple representations
Dots 2 × TABLES MULTIPLICATION.
Dividing Decimals Guided Notes
Times.
Dots 4 × TABLES MULTIPLICATION.
10 × 8 = 80 5 × 8 = 40 6 × 8 = CONNECTIONS IN 8 × TABLE MULTIPLICATION.
3 × 12 = 36 6 × 12 = 72 7 × 12 = CONNECTIONS IN 12 × TABLE
Ch. 4 - Atomic Structure II. Masses of Atoms Ch.4 Mass Number Isotopes
III. Masses of Atoms Atomic Mass Mass Number Isotopes
5 × 12 = × 12 = × 12 = CONNECTIONS IN 12 × TABLE MULTIPLICATION.
5 × 9 = 45 6 × 9 = 54 7 × 9 = CONNECTIONS IN 9 × TABLE
3 × 7 = 21 6 × 7 = 42 7 × 7 = CONNECTIONS IN 7 × TABLE
Dots 3 × TABLES MULTIPLICATION.
Presentation transcript:

ROLAPs, Rollups and Cubes: an Introduction to Super Groups CS240A Notes from A Complete Guide to DB2 Universal Database, by Don Chamberlin, Morgan Kaufmann Publishers, Inc., 1998

The Census Database

ROLLUP SELECT state, avg(income) AS avg_income FROM census GROUP BY ROLLUP(state)

ROLLUP: a more complex example The total population and the average income in each city, county, and state, and the census as a whole: SELECT state, county, city count(*) AS population, avg(income) AS avg_income FROM census GROUP BY ROLLUP (state, county, city);

ROLLUP more complex example: Result

Getting Rid of nulls by using the grouping(A) function SELECT CASE grouping(state) WHEN 1 THEN ‘(-all-)’ ELSE state END AS state, CASE grouping(county) WHEN 1 THEN ‘(-all-)’ ELSE county END AS county, CASE grouping(city) WHEN 1 THEN ‘(-all-)’ ELSE city END AS city, count(*) AS pop, avg(income) AS avg_income FROM census GROUP BY ROLLUP(state, count, city);

Result of getting rid of nulls

Using WHERE & HAVING in ROLLUPs SELECT CASE grouping(state) WHEN 1 THEN ‘(-all-)’ ELSE state END AS state, CASE grouping(county) WHEN 1 THEN ‘(-all-)’ ELSE county END AS county, CASE grouping(city) WHEN 1 THEN ‘(-all-)’ ELSE city END AS city, count(*) AS pop, avg(income) AS avg_income FROM census WHERE sex= ‘F’ GROUP BY ROLLUP(state, count, city) HAVING count(*) >=2;

Result of WHERE and HAVING on ROLLUP

The CUBE Effect of sex and birth date on income. Four possible ways to group: SELECT sex, year(brirthdate) AS birth_year max(income) AS max_income FROM census GROUP BY CUBE(sex, year(birthdate)); 1.by sex and birthdate, 2.by sex only 3.By birthdate only 4.By nothing—the table becomes one big group

Result of Cubing on Sex and Birth Year

A 3-D Cube: size and avg income for groups of size  4 SELECT CASE grouping(state) WHEN 1 THEN ‘(-all)’ ELSE state END AS state, CASE grouping(sex) WHEN 1 THEN ‘(-all)’ ELSE sex END AS sex, CASE grouping(year(brirthdate)) WHEN 1 THEN ‘(-all)’ ELSE char(year(brirthdate)) END AS birth_date count(*) AS count, avg(income) AS avg_income FROM census GROUP BY CUBE(state, sex, year(birthdate)) HAVING count(*) >= 4;

Size and Income for groups of size  4:result

Grouping Sets SELECT CASE grouping(state) WHEN 1 THEN ‘(-all-)’ ELSE state END AS state, CASE grouping(sex) WHEN 1 THEN ‘(-all-)’ ELSE sex END AS sex, CASE grouping(year(birthdate)) WHEN 1 THEN ‘(-all-)’ ELSE char(year(birthdate)) END AS birth_year, count(*) AS count, avg(income) AS avg_income FROM census GROUP BY GROUPING SETS (state, sex), year(birthdate), ();

Result of Grouping Sets

Multiple Grouping Specifications SELECT CASE grouping(state) WHEN 1 THEN ‘(-all-)’ ELSE state END AS state, CASE grouping(county) WHEN 1 THEN ‘(-all-)’ ELSE county END AS county, sex, count(*) AS pop, avg(income) AS avg_income FROM census GROUP BY ROLLUP(state, county), sex;

Result of Multiple Grouping