Window aggregate functions

Window aggregate functions return a value for a specified set of rows in the input. For example, you can use window functions to calculate a moving average of the sales figures for a company over a specified time period.

For the purposes of explanation in this chapter, the window aggregate functions are broken up into three categories:

  • Basic aggregate functions   Following is the list of supported basic aggregate functions:

    • SUM
    • AVG
    • MAX
    • MIN
    • FIRST_VALUE
    • LAST_VALUE
    • COUNT

  • Standard deviation and variance functions   Following is the list of supported standard deviation and variance functions:

    • STDDEV
    • STDDEV_POP
    • STDDEV_SAMP
    • VAR_POP
    • VAR_SAMP
    • VARIANCE

  • Correlation and linear regression functions   Following is the list of supported correlation and linear regression functions:

    • COVAR_POP
    • COVAR_SAMP
    • REGR_AVGX
    • REGR_AVGY
    • REGR_COUNT
    • REGR_INTERCEPT
    • REGR_R2
    • REGR_SLOPE
    • REGR_SXX
    • REGR_SXY
    • REGR_SYY


Basic aggregate functions
Standard deviation and variance functions
Correlation and linear regression functions