The SQL of OLAP > > Intelligent Enterprise: Better Insight for Business Decisions

Welcome Guest. | Log In| Register | Membership Benefits

Intelligent Enterprise

Better Insight for Business Decisions

Intelligent Enterprise - Better Insight for Business Decisions
search Intelligent Enterprise
RSS
Webcasts
Digital Library
Subscribe
Home


  • EMAIL
  • PRINT
  • REPRINTS
  • Follow Us on Twitter
  • FOLLOW US
  • Share

The SQL of OLAP


Don't overlook the underpinning - and core strength - of your OLAP technology solution.

Don't overlook the core strength of your OLAP technology solution: SQL.


By Michael Gonzales
September 18, 2004

Page 3

Moreover, when you use an OLAP function with a column function, such as AVG, SUM, or MAX, the target rows can be further refined, relative to the current row, as either a range or a number of rows preceding and following the current row. For example, within a window partitioned by month, a moving average can be calculated over the previous three-month period.

The value of having these terms available in leading product lines is that you can call upon the entire SQL vocabulary to combine in any of your OLAP-centric SQL statements.

OLAP Examples of SQL

The following example illustrates an advanced OLAP function used in combination with traditional SQL. The result is a valuable SQL statement that epitomizes the power and relevance of BI at the database engine level.

This example shows a rollup function of sales by region and city:

SELECT b.region_type_id,
a.city_id,
SUM(a.sales) AS
TOTAL_SALES
FROM fact_table a,
lookup_market b
WHERE YEAR(transdate)
=1999
AND a.city_id=b.city_id
AND b.region_type_id=6
GROUP BY ROLLUP
(b.region_type_id,
a.city_id)
ORDER BY
b.region_type_id,
a.city_id

The resultant set is reduced by explicitly querying region 6 and the year 1999. A sample result of the SQL is shown in Table 1, below. The result shows ROLLUP of two groupings (region, city) returning three totals, including region, city, and grand total.

Table 1: Yearly sales by city and region.

Enterprisewide Dimensional Layer

The traditional data warehouse architecture includes an atomic layer of granular data, often normalized, that serves as the only source of data for subsequent, subject-specific data marts. Generally, the data marts are implemented as star schemas, proprietary MOLAP cubes, or both. Establishing a layer of data marts provides an excellent foundation from which to serve up consistent, multidimensional data on an enterprise scale. But when you couple the current notion of data marts with OLAP-centric SQL functions, it's important that BI architects confirm the value added from proprietary, OLAP-only technology, specifically proprietary multidimensional database servers.


  • EMAIL
  • PRINT
  • REPRINTS
  • Follow Us on Twitter
  • FOLLOW US
  • Share


 





New on the BLOG
Text Data Quality: Mistakes and More
11.25.2009
blog author
Seth Grimes
I wrote recently on Text Data Quality, looking at issues that affect analytical accuracy, that "the basic text data quality issue is that humans make mistakes, and the challenge is that people's natural-language mistakes defy easy, automated detection." This topic and related non-erroneous vagaries of human language bear further exploration...

Read more from Seth Grimes >>

Curt Monash
Reports of Perfectly-Balanced Hardware Configurations are Greatly Exaggerated
Data warehouse appliance and software appliance vendors like to claim that they've worked out just the right hardware configuration(s), and that a single configuration is correct for a fairly broad range of workloads. But there are a lot of reasons to be dubious about that. Specific vendor evidence includes...

11.24.2009
Read more from Curt Monash >>

Google Chrome OS: Don't Link it to Cloud Computing
11.23.2009
blog author
David Linthicum
With much fanfare, the Google Chrome OS launched last week. Chrome OS is a Web operating system that boots quickly, right into a browser... We've been here before... And I would rather not bind Chrome to cloud computing because I don't think the OS will be around long.

Read more from David Linthicum >>



Intelligent Enterprise Newsletters
Subscribe Here:
*Email:
 First Name:
 Last Name:
  Intelligent Enterprise Blogosphere Newsletter:
  Intelligent Enterprise Newsletter:

Email Type: