In Oracle PL/SQL, STDDEV is a built in function which returns the standard deviation of a set of numbers, i.e. the square root of the variance for the input number set. It can be used as both an Aggregate and an Analytic function.
Standard deviation is a widely used measurement of variability or diversity used in statistics and probability theory. It shows how much variation or "dispersion" there is from the "average" (mean, or expected/budgeted value). A low standard deviation indicates that the data points tend to be very close to the mean, whereas high standard deviation indicates that the data are spread out over a large range of values.
Note that STDDEV returns zero for input set which contains only one element.
STDDEV( [ DISTINCT | ALL ] expression )
STDDEV( [ DISTINCT | ALL ] expression ) [ OVER ( analytical_clause ) ]
The SQL statement below returns the standard deviation of the Quantity field from ORDERS table.
The SQL statement below returns the cumulative standard deviation of the quantity over the orders against each date.
SELECT DT,STDDEV(QTY) OVER (ORDER_BY dt)
Related Code Snippets:
- STDDEV - Returns the standard deviation. it returns STDDEV_SAMP if the number of pairs is more tha...