SQL functions

Metric and records in Insight may use different aggregate functions that are basic SQL functions.

Function

Description

SUM

Calculates the sum of all expression values.

AVG

Calculates the average of the expression values in a group.

STDEV

Returns the statistical standard deviation of all values in the specified expression.

COUNT

Calculates the number of rows in the query.

COUNT UNIQUE

Returns the number of unique items in a group.

MIN

Returns the minimum value in the expression.

MAX

Returns the maximum value in the expression.

ABS

Returns the absolute (positive) value of the expression.

CEIL

Returns the smallest integer that is greater than or equal to the expression.

FLOOR

Returns the largest integer less than or equal to the expression.

TO DATE

Converts an expression of a compatible data type/format into DATE/DATETIME data type.

SQRT

Extracts the square root from the expression.

IF-THEN-ELSE

Returns the specified type of values depending on whether the condition is executed or not.

WHERE_IN

Returns a specified set of values in the expression.

WHERE_NOT_IN

Returns a specified set of values in the expression if the condition is not true.