Aggregate

SQL Aggregate Functions

Index

General Aggregate Function

Binary Set Functions

Ordered Aggregate Functions

Hypothetical Set Functions

Inverse Distribution Functions

JSON Aggregate Functions

Details

General Aggregate Functions

AVG

circle-info

Return average (mean) value. If no rows are selected, the result is NULL. Aggregation are only allowed in select statements.

The data type of result is DOUBLE PRECISION for TINYINT, SMALLINT, INTEGER, and REAL arguments, NUMERIC with additional 10 decimal digits of precision and scale for BIGINT and NUMERIC arguments; DECFLOAT with additional 10 decimal digits of precision for DOUBLE PRECISION and DECFLOAT arguments; INTERVAL with the same leading field precision, all additional smaller datetime units in interval qualifier, and the maximum scale for INTERVAL arguments.

Examples:

MAX

circle-info

The highest value. If no rows are selected, the result is NULL. Aggregate are only allowed in

select statements. The returned value is of the same data type are the parameter.

Examples:

MIN

circle-info

The lowest value. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. The returned value is of the same data type as the parameter.

Examples:

SUM

circle-info

The sum of all values. If no rows are selected, the result is NULL.Aggregates are only allowed in select statements.

Examples:

EVERY

circle-info

Returns true if all expressions are true. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements.

Examples:

ANY

circle-info

Returns true if any expression is true. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements.

Note that if ANY or SOME aggregate function is placed on the right side of comparison operation or distinct predicate and argument of this function is a subquery additional parentheses around aggregate function are required, otherwise it will be parsed as quantified predicate.

Examples:

COUNT

circle-info

TODO

STDDEV_POP

circle-info

TODO

STDDEV_SAMP

circle-info

TODO

VAR_POP

circle-info

TODO

VAR_SAMP

circle-info

TODO

BIT_AND_AGG

circle-info

TODO

BIT_OR_AGG

circle-info

TODO

BIT_XOR_AGG

circle-info

TODO

BIT_NAND_AGG

circle-info

TODO

BIT_NOR_AGG

circle-info

TODO

BIT_XNOR_AGG

circle-info

TODO

ENVELOPE

circle-info

TODO

Binary Set Functions

COVAR_POP

circle-info

TODO

COVAR_SAMP

circle-info

TODO

CORR

circle-info

TODO

REGR_SLOPE

circle-info

TODO

REGR_INTERCEPT

circle-info

TODO

REGR_COUNT

circle-info

TODO

REGR_R2

circle-info

TODO

REGR_AVGX

circle-info

TODO

REGR_AVGY

circle-info

TODO

REGR_SXX

circle-info

TODO

REGR_SYY

circle-info

TODO

REGR_SXY

circle-info

TODO

Ordered Aggregate Functions

LISTAGG

circle-info

TODO

ARRAY_AGG

circle-info

TODO

Hypothetical Set Functions

RANK aggregate

circle-info

TODO

DENSE_RANK aggregate

circle-info

TODO

PERCENT_RANK aggregate

circle-info

TODO

CUME_DIST aggregate

circle-info

TODO

Inverse Distribution Functions

PERCENTILE_CONT

circle-info

TODO

PERCENTILE_DISC

circle-info

TODO

MEDIAN

circle-info

TODO

MODE

circle-info

TODO

JSON Aggregate Functions

JSON_OBJECAGG

circle-info

TODO

JSON_ARRAYAGG

circle-info

TODO

Last updated

Was this helpful?