Using the Window Functions : Window Functions « Analytical Functions « Oracle PL/SQL Tutorial






Window functions calculates things like

  1. cumulative sums,
  2. moving averages within a specified range of rows,
  3. a range of values, or
  4. an interval of time.

Window function can work with: SUM(), AVG(), MAX(), MIN(), COUNT(), VARIANCE(), and STDDEV().

Window function can also work with FIRST_VALUE() and LAST_VALUE(), which return the first and last values in a window.









16.29.Window Functions
16.29.1.Using the Window Functions
16.29.2.Performing a Cumulative Sum
16.29.3.Use ROWS UNBOUNDED PRECEDING to implicitly indicate the end of the window is the current row
16.29.4.Performing a Moving Average
16.29.5.Performing a Centered Average
16.29.6.Moving average
16.29.7.Row-ordering is done first and then the moving average
16.29.8.Use SUM for windowing
16.29.9.Use the COUNT aggregate analytical function to show how many rows are included in each window
16.29.10.An Expanded Example of a Physical Window
16.29.11.Displaying which rows are used in the moving average calculations with two other analytical functions: FIRST_ VALUE and LAST_VALUE.