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.

Window aggregate functions are organized into the following three categories:

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

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

    For more information about basic aggregate functions, see Basic aggregate functions.

  • 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

    For more information about standard deviation and variance functions, see Standard deviation and variance functions.

  • 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

    For more information about correlation and linear regression functions, see Correlation and linear regression functions.