How it works...

We have used OLAP extensions in the query so that query can be manipulated by any size of dataset for OLAP and data mining processes. The OLAP extensions include the SQL expressions:

  • RANK
  • QUALIFY
  • CSUM
  • MAVG OR MSUM
  • MDIFF

Here we have defined the window via:

  • PARTITION BY: Clause defining the grouping of data
  • ORDER BY: Clause defining the sequence of data
  • ROWS BETWEEN: Defines the window used for calculation

All window aggregate functions broadly fall into four categories, which are used in connection with aggregate functions, as can be seen in the following figure:

Get Teradata Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.