SAMPLE:下例返回部门30按雇佣日期排序的薪水值的累积标准偏离
SELECT last_name, hire_date,salary, STDDEV(salary) OVER (ORDER BY hire_date) "StdDev" FROM employees WHERE department_id = 30;
LAST_NAME HIRE_DATE SALARY StdDev ------------------------- ---------- ---------- ---------- Raphaely 07-12月-94 11000 0 Khoo 18-5月 -95 3100 5586.14357 Tobias 24-7月 -97 2800 4650.0896 Baida 24-12月-97 2900 4035.26125 Himuro 15-11月-98 2600 3649.2465 Colmenares 10-8月 -99 2500 3362.58829
STDDEV_POP
|
功能描述:该函数计算总体标准偏离,并返回总体变量的平方根,其返回值与VAR_POP函数的平方根相同。(Standard Deviation-Population)
SAMPLE:下例返回部门20、30、60的薪水值的总体标准偏差
SELECT department_id, last_name, salary, STDDEV_POP(salary) OVER (PARTITION BY department_id) AS pop_std FROM employees WHERE department_id in (20,30,60);
DEPARTMENT_ID LAST_NAME SALARY POP_STD ------------- ------------------------- ---------- ---------- 20 Hartstein 13000 3500 20 Fay 6000 3500 30 Raphaely 11000 3069.6091 30 Khoo 3100 3069.6091 30 Baida 2900 3069.6091 30 Colmenares 2500 3069.6091 30 Himuro 2600 3069.6091 30 Tobias 2800 3069.6091 60 Hunold 9000 1722.32401 60 Ernst 6000 1722.32401 60 Austin 4800 1722.32401 60 Pataballa 4800 1722.32401 60 Lorentz 4200 1722.32401
STDDEV_SAMP
|
功能描述: 该函数计算累积样本标准偏离,并返回总体变量的平方根,其返回值与VAR_POP函数的平方根相同。(Standard Deviation-Sample)