Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
admin:features:rollups:create [2012/02/16 19:29]
doc
admin:features:rollups:create [2016/06/28 22:38] (current)
Line 12: Line 12:
  
 ==== Creating Rollup Tables ==== ==== Creating Rollup Tables ====
-A rollup table is quite easy to create. ​ The rollup tables are first created in the Omnidex Environment File, complete with the SQL statement that represents the rollup data.  Then the UPDATE ROLLUPS statement is issued in ODXSQL to populate the rollup tables. ​ Here is a simple example of creating ​rollup that provides counts ​of people based on geographic regions:+A rollup table is quite easy to create. ​ The rollup tables are first created in the Omnidex Environment File, complete with the SQL statement that represents the rollup data.  Then the UPDATE ROLLUPS statement is issued in ODXSQL to populate the rollup tables. ​ Here is a simple example of declaring ​regular table, followed by the creation ​of two rollup tables:
  
-<​code ​sql+<​code>​ 
-  create table          "LIST_GEO" ​        +create table          "INDIVIDUALS"​ 
-    ​type ​               ROLLUP + ​physical ​            "​dat/​individuals.dat"​ 
-    ​physical ​           "​dat/​list.geo+ ( 
-    ​as ​                 ​"select COUNTRYREGIONSTATECOUNTYCITYZIPMSA_CSAPMSA,  +  "​INDIVIDUAL" ​       ​CHARACTER(12),​ 
-                         ​count(*) NUM_INDIVIDUALS +  "​HOUSEHOLD" ​        ​CHARACTER(12),​ 
-                         ​from LIST +  "​NAME" ​             CHARACTER(50),​ 
-                         ​group by COUNTRYREGIONSTATECOUNTYCITYZIPMSA_CSAPMSA" ​+  "​GENDER" ​           CHARACTER(1),​ 
 +  "​BIRTHDATE" ​        ANSI DATE, 
 +  "​PHONE" ​            ​CHARACTER(14),​ 
 +  "​EMAIL" ​            ​CHARACTER(60),​ 
 +  constraint INDIVIDUALS_INDIVIDUAL_PK primary ("​INDIVIDUAL"​),​ 
 +  constraint INDIVIDUALS_HOUSEHOLD_FK foreign ("​HOUSEHOLD"​) references "​HOUSEHOLDS",​ 
 +  constraint INDIVIDUALS_GENDER_FK foreign ("​GENDER"​) references "​GENDERS",​ 
 + ) 
 + ​in ​                  "​simple.xml";​ 
 + 
 +create table          "​INDIVIDUALS_BY_HOUSEHOLD"​ 
 + ​physical ​            "dat/individuals_by_household.dat
 + 
 +  ​"HOUSEHOLD" ​        ​CHARACTER(12), 
 +  "​GENDER" ​           CHARACTER(1), 
 +  "​BIRTHDATE" ​        ANSI DATE, 
 +  "​NUM_INDIVIDUALS" ​  ​UNSIGNED INTEGER, 
 +  constraint INDIVIDUALS_HOUSEHOLD_FK foreign ("​HOUSEHOLD"​) references "​HOUSEHOLDS"​, 
 +  constraint INDIVIDUALS_GENDER_FK foreign ("​GENDER"​) references "​GENDERS"​, 
 + ) 
 + as "​select ​          ​HOUSEHOLD, 
 +                      GENDER
 +                      ​BIRTHDATE,​ 
 +                      ​count(*) ​ NUM_INDIVIDUALS 
 +       ​from           INDIVIDUALS 
 +       ​group by       HOUSEHOLD, 
 +                      GENDER, 
 +                      BIRTHDATE"​ 
 + ​in ​                  "​simple.xml";​ 
 + 
 + 
 +create table          "​INDIVIDUALS_BY_DEMO"​ 
 + ​physical ​            "​dat/​individuals_by_demo.dat"​ 
 + ( 
 +  "​GENDER" ​           CHARACTER(1), 
 +  "​BIRTHDATE" ​        ANSI DATE, 
 +  "​NUM_INDIVIDUALS" ​  ​UNSIGNED INTEGER, 
 +  constraint INDIVIDUALS_GENDER_FK foreign ("​GENDER"​) references "​GENDERS"​, 
 + ) 
 + as "​select ​          ​GENDER, 
 +                      BIRTHDATE,​ 
 +                      count(*) ​ NUM_INDIVIDUALS 
 +       ​from ​          ​INDIVIDUALS 
 +       group by       ​GENDER,​ 
 +                      BIRTHDATE"​ 
 + ​in ​                  "​simple.xml";
 </​code>​ </​code>​
  
Line 30: Line 75:
 In ODXSQL, ODBC or JDBC, the following statement will populate the rollup tables in the Omnidex Environment:​ In ODXSQL, ODBC or JDBC, the following statement will populate the rollup tables in the Omnidex Environment:​
  
- update rollups ​+<​code>​ 
 +update rollups 
 +Database 
 + ​Table ​                                      ​Rows ​       CPU    Elapsed 
 +---------------------------------------------------------------------------- 
 +SIMPLE 
 + ​INDIVIDUALS_BY_HOUSEHOLD ​                  ​5,​000 ​      ​0:​00 ​      ​0:​00 
 + ​INDIVIDUALS_BY_DEMO ​                       4,793       ​0:​00 ​      ​0:​00 
 +---------------------------------------------------------------------------- 
 +Total                                                   ​0:​00 ​      ​0:​00 
 + 
 +Rollup tables updated 
 +</​code>​
  
 ====  ==== ====  ====
 
Back to top
admin/features/rollups/create.1329420563.txt.gz · Last modified: 2016/06/28 22:38 (external edit)