Differences

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

Link to this comparison view

admin:features:rollups:create [2012/02/17 16:35]
doc
admin:features:rollups:create [2016/06/28 22:38]
Line 1: Line 1:
-~~NOTOC~~ 
  
-{{page>:​top_add&​nofooter&​noeditbtn}} 
- 
-====== Administration:​ Omnidex Features ====== 
- 
-===== Rollup Tables ===== 
- 
-[[admin:​features:​rollups:​home|Overview]] | [[admin:​features:​rollups:​design|Design]] | **[[admin:​features:​rollups:​create|Creation]]** | [[admin:​features:​rollups:​indexing|Indexing]] | [[admin:​features:​rollups:​optimization|Optimization]] 
- 
----- 
- 
-==== 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 declaring a regular table, followed by the creation of two rollup tables: 
- 
-<​code>​ 
-create table          "​INDIVIDUALS"​ 
- ​physical ​            "​dat\individuals.dat"​ 
- ( 
-  "​INDIVIDUAL" ​       CHARACTER(12) ​    ​omnidex,​ 
-  "​HOUSEHOLD" ​        ​CHARACTER(12) ​    ​omnidex,​ 
-  "​NAME" ​             CHARACTER(50) ​    ​quicktext,​ 
-  "​GENDER" ​           CHARACTER(1) ​     omnidex bitmap, 
-  "​BIRTHDATE" ​        ANSI DATE         ​omnidex,​ 
-  "​PHONE" ​            ​CHARACTER(14) ​    ​omnidex,​ 
-  "​EMAIL" ​            ​CHARACTER(60) ​    ​quicktext,​ 
-  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) ​    ​omnidex,​ 
-  "​GENDER" ​           CHARACTER(1) ​     omnidex bitmap, 
-  "​BIRTHDATE" ​        ANSI DATE         ​omnidex,​ 
-  "​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) ​     omnidex bitmap, 
-  "​BIRTHDATE" ​        ANSI DATE         ​omnidex,​ 
-  "​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>​ 
- 
-IMPORTANT: Note that the aggregation has a column alias of NUM_INDIVIDUALS. ​ It is required that all aggregation functions have column aliases as the alias becomes the column name in the table. 
- 
- 
- 
-In ODXSQL, ODBC or JDBC, the following statement will populate the rollup tables in the Omnidex Environment:​ 
- 
-<​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>​ 
- 
-====  ==== 
-**[[admin:​features:​rollups:​design|Prev]]** | **[[admin:​features:​rollups:​indexing|Next]]** 
- 
-====== Additional Resources ====== 
- 
-{{page>:​admin:​features:​see_also&​nofooter&​noeditbtn}} 
- 
-{{page>:​bottom_add&​nofooter&​noeditbtn}} 
 
Back to top
admin/features/rollups/create.txt ยท Last modified: 2016/06/28 22:38 (external edit)