This function is used to return the variance of a column.
variance(col), var_pop(col)
Parameter |
Mandatory |
Description |
---|---|---|
col |
Yes |
Columns with a data type of numeric. If the value is of any other type, NULL is returned. |
The return value is of the DOUBLE type.
select variance(items) from warehouse; -- It is equivalent to the following statement: select var_pop(items) from warehouse;
The command output is as follows:
_c0 203.42352
select warehourseId, variance(items) from warehourse group by warehourseId; -- It is equivalent to the following statement: select warehourseId, var_pop(items) from warehourse group by warehourseId;
The command output is as follows:
1 2 3 4 | warehouseId _c1 city1 19.23124 city2 17.23344 city3 12.43425 |