<< Click to Display Table of Contents >> ## Operations Used in Commands |

The following list of operations are used in a number of StreamLab commands.

AVG

AVG returns the average of all the value expressions evaluated for each row in the aggregation.

COUNT

The COUNT function returns the number of qualifying rows in the aggregation.

FIRST_VALUE

FIRST_VALUE returns the evaluation of the <value expression> from the first row that qualifies for the aggregate.

LAST_VALUE

LAST_VALUE returns the evaluation of the <value expression> from the last row that qualifies for the aggregate.

MAX

MAX returns the maximum value of all the value expressions evaluated for each row in the aggregation. For string values, MAX is determined by which string is last in the collating sequence.

MIN

MIN returns the minimum value of all the value expressions evaluated for each row in the aggregation.

SUM

SUM returns the sum of all the value expressions evaluated for each row in the aggregation.

STDDEV_POP

STDDEV_POP returns the returns the square root of the population variance (VAR_POP) for <number expression>, evaluated for each row remaining in the group.

STDDEV_SAMP

STDDEV_SAMP returns the statistical standard deviation of all values in number-expression, evaluated for each row remaining in the group and defined as the square root of the sample variance (VAR_SAMP).

VAR_POP

VAR_POP returns the population variance of a non-null set of numbers (nulls being ignored). VAR_POP uses the following calculation:

(SUM(expr*expr) - SUM(expr)*SUM(expr) / COUNT(expr)) / COUNT(expr)

In other words, for a given set of non-null values, using S1 as the sum of the values and S2 as the sum of the squares of the values, VAR_POP returns the result (S2-S1*S1/N)/N.

VAR_SAMP

VAR_SAMP returns the sample variance of a non-null set of numbers (nulls being ignored).

VAR_SAMP uses the following calculation:

(SUM(expr*expr) - SUM(expr)*SUM(expr) / COUNT(expr)) / (COUNT(expr)-1)

In other words, for a given set of non-null values, using S1 as the sum of the values and S2 as the sum of the squares of the values, VAR_POP returns the result (S2-S1*S1/N)/(N-1).