Computes the sample variance of all non-Documentation Index
Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
Use this file to discover all available pages before exploring further.
NULL numeric values produced by an expression. The sample variance measures the average of the squared differences from the sample mean, indicating how spread out the values are within a sample.
For information about the population variance, which measures how spread out the values are within the full population, see VAR_POP.
Alias: VARIANCE
Syntax
Parameters
| Parameter | Description | Supported input types |
|---|---|---|
<expression> | An expression producing numeric values for which to calculate the sample variance. | REAL, DOUBLE PRECISION |
<condition> | An optional boolean expression to filter rows used in aggregation | BOOL |
Return Type
VAR_SAMP returns a result of type DOUBLE PRECISION.
Special cases
- If there is at most one non-
NULLinput value, the result isNULL. - If the input contains an
InforNaNvalue, the result will beNaN.
Example
The following code creates anexams table with a grade column of type DOUBLE PRECISION, and inserts five grade values into it:
exams table, rounds the result to three decimal places, and returns it as variance:
| variance (DOUBLE PRECISION) |
|---|
| 0.342 |