Skip Headers

Oracle9i SQL Reference
Release 2 (9.2)

Part Number A96540-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page Go to next page
View PDF

STDDEV_POP

Syntax

stddev_pop::=

Text description of functions159.gif follows
Text description of stddev_pop


See Also:

"Analytic Functions" for information on syntax, semantics, and restrictions

Purpose

STDDEV_POP computes the population standard deviation and returns the square root of the population variance. You can use it as both an aggregate and analytic function.

The expr is a number expression, and the function returns a value of type NUMBER. This function is the same as the square root of the VAR_POP function. When VAR_POP returns null, this function returns null.

See Also:

Aggregate Example

The following example returns the population and sample standard deviations of the amount of sales in the sample table sh.sales:

SELECT STDDEV_POP(amount_sold) "Pop", 
   STDDEV_SAMP(amount_sold) "Samp"
   FROM sales;

       Pop       Samp
---------- ----------
896.355151 896.355592

Analytic Example

The following example returns the population standard deviations of salaries in the sample hr.employees table by department:

SELECT department_id, last_name, salary, 
   STDDEV_POP(salary) OVER (PARTITION BY department_id) AS pop_std
   FROM employees;

DEPARTMENT_ID LAST_NAME                     SALARY    POP_STD
------------- ------------------------- ---------- ----------
           10 Whalen                          4400          0
           20 Hartstein                      13000       3500
           20 Goyal                           6000       3500
.
.
.
          100 Sciarra                         7700 1644.18166
          100 Urman                           7800 1644.18166
          100 Popp                            6900 1644.18166
          110 Higgens                        12000       1850
          110 Gietz                           8300       1850