Analytical Functions

Analytical functions include simple aggregates, window functions, and numeric functions.

  • Simple aggregates — AVG, COUNT, MAX, MIN, and SUM, STDDEV, and VARIANCE

    Note: You can use all simple aggregates, except the Grouping() function, with an OLAP windowed function.
  • Window functions:

    • Windowing aggregates — AVG, COUNT, MAX, MIN, and SUM.

    • Ranking functions — RANK, DENSE_RANK, PERCENT_RANK, ROW_NUMBER, and NTILE.

    • Statistical functions — STDDEV, STDDEV_SAMP, STDDEV_POP, VARIANCE, VAR_SAMP, and VAR_POP.

    • Distribution functions — PERCENTILE_CONT and PERCENTILE_DISC.

    • Inter-row functions — LAG and LEAD.

  • Numeric functions — WIDTH_BUCKET, CEIL, and LN, EXP, POWER, SQRT, and FLOOR.

    Note: The ranking and inverse distribution analytical functions are not supported by Adaptive Server.

Unlike some aggregate functions, you cannot specify DISTINCT in window functions.

* The OLAP SQL standard allows Grouping() in GROUP BY CUBE, or GROUP BY ROLLUP operations only.

Related reference
Aggregate Functions
AVG Function [Aggregate]
COUNT Function [Aggregate]
DENSE_RANK Function [Analytical]
GROUPING Function [Aggregate]
MAX Function [Aggregate]
MIN Function [Aggregate]
NTILE Function [Analytical]
PERCENT_RANK Function [Analytical]
PERCENTILE_CONT Function [Analytical]
PERCENTILE_DISC Function [Analytical]
RANK Function [Analytical]
ROW_NUMBER Function [Analytical]
STDDEV Function [Aggregate]
STDDEV_POP Function [Aggregate]
STDDEV_SAMP Function [Aggregate]
SUM Function [Aggregate]
VAR_POP Function [Aggregate]
VAR_SAMP Function [Aggregate]
VARIANCE Function [Aggregate]