Updated on 2026-11-06 GMT+08:00
var_samp
Function
The var_samp function is used to return the sample variance of the specified column.
Syntax
var_samp(col)
Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| col | Yes | A column with numeric data type. Other types return NULL. |
Return Values
Returns a value of type DOUBLE.
Examples
- Calculate the sample variance of all items inventory. Example command:
select var_samp(items) from warehouse;
Result:
_c0 294.342355
- Used with GROUP BY to group all items by warehouse (warehouseId) and calculate the sample variance of items inventory within the same group. Example command:
select warehouseId, var_samp(items) from warehouse group by warehouseId;
Result:
warehouseId _c1 city1 18.23124 city2 16.23344 city3 11.43425
Parent topic: Aggregate Functions
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot