STDDEV/STDDEV_SAMP
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Computes the sample standard deviation of input values.
Syntax
Arguments
Required
<expression>: An expression of any numerical type.
Returns
NUMERIC(38,6) for integer-type or numeric arguments.
double precision for floating-point arguments.
Returns NULL if the computation is meaningless.
Considerations
- Uses N-1 in the denominator (Bessel’s correction).
- Use
STDDEV_POP for population standard deviation.
- Cast the input to
double precision to get a double precision result.
Examples
Calculate Standard Deviation
Find the standard deviation of prices.
1SELECT stddev(price) AS price_stddev
2FROM products;
Standard Deviation by Group
Calculate standard deviation for each category.
1SELECT category, stddev(price) AS price_stddev
2FROM products
3GROUP BY category;
Force Double Precision Output
Cast to get a specific output type.
1SELECT stddev(CAST(quantity AS double precision)) AS qty_stddev
2FROM orders;
Related Documentation