

# Statistical Variance and Deviation Functions
<a name="sql-reference-statistical-variance-deviation-functions"></a>

Each of these functions takes a set of numbers, ignores nulls, and can be used as either an aggregate function or an analytical function. For more information, see [Aggregate Functions](sql-reference-aggregate-functions.md) and [Analytic Functions](sql-reference-analytic-functions.md).

The relationships among these functions are described in the following table.


| Function purpose | Function name | Formula | Comments | 
| --- | --- | --- | --- | 
|  Hotspots  |  [HOTSPOTS](sqlrf-hotspots.md) (expr)  |  Detects hotspots of frequently occurring data in the data stream.  |    | 
|  Random Cut Forest  |  [RANDOM\$1CUT\$1FOREST](sqlrf-random-cut-forest.md) (expr)  |  Detects anomalies in the data stream.  |    | 
|  Random Cut Forest with Explanation  |  [RANDOM\$1CUT\$1FOREST\$1WITH\$1EXPLANATION](sqlrf-random-cut-forest-with-explanation.md) (expr)  |  Detects anomalies in the data stream, and returns an attribution score based on how anomalous the data in each column is.  |    | 
|  Population variance  |  [VAR\$1POP](sql-reference-VARPOP.md)(expr)  |  ( SUM(expr\$1expr) - SUM(expr)\$1SUM(expr) / COUNT(expr)) / COUNT(expr)  |  Applied to an empty set, it returns null.  | 
|  Population standard deviation  |  [STDDEV\$1POP](sql-reference-STDDEVPOP.md)  |  Square root of the population variance (VAR\$1POP).  |  When VAR\$1POP returns null, STDDEV\$1POP returns null.  | 
|  Sample variance  |  [VAR\$1SAMP](sql-reference-VARSAMP.md)  |  (SUM(expr\$1expr) - SUM(expr)\$1SUM(expr) / COUNT(expr)) / (COUNT(expr)−1)  |  Applied to an empty set, it returns null.  Applied to an input set of one element, VAR\$1SAMP returns null.  | 
|  Sample standard deviation  |  [STDDEV\$1SAMP](sql-reference-STDDEVSAMP.md) (expr)  |  Square root of the sample variance (VAR\$1SAMP).  |  Applied to only 1 row of input data, STDDEV\$1SAMP returns null.  | 