O'Reilly logo

Joe Celko's SQL for Smarties, 5th Edition by Joe Celko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 25

OLAP Aggregation in SQL

Abstract

Reports, also known as OLAP queries, mix unlike things into the same row or the same table. This is done for reporting rather than traditional queries.

Keywords

Online transaction processing

GROUP BY

OLAP

ROLLUP

CUBE

GROUPING(< column reference >) function

GROUPING SET

OVER()

ORDER BY

PARTITION BY

< null ordering >

ROWS

RANGE

UNBOUNDED PRECEDING

CURRENT ROW

BETWEEN

EXCLUDE

Ordinal functions

ROW_NUMBER()

RANK()

DENSE_RANK()

PERCENT_RANK()

CUME_DIST

LEAD

LAG

FIRST

LAST

FIRST_VALUE

LAST_VALUE

Most sql programmers work with OLTP (online transaction processing) databases and write simple, one-level aggregations. This chapter reviews how the usual GROUP BY clause works. The result set is partitioned ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required