zoukankan      html  css  js  c++  java
  • 使用oracle来计算方差及标准差

    /* Formatted on 5/24/2012 4:15:58 PM (QP5 v5.149.1003.31008) */
    SELECT deptno,
          ename,                     --st_name || ' ' || last_name employee_name,
          hiredate,
         sal,
           STDDEV (sal) OVER (PARTITION BY deptno ORDER BY hiredate) AS "STDDEV", --标准差
           STDDEV_SAMP (sal) OVER (PARTITION BY deptno ORDER BY hiredate)
              AS "STDDEV_SAMP",                                            --样本标准差
           VAR_POP (sal) OVER (PARTITION BY deptno ORDER BY hiredate)    说明:VAR_POP 为函数, sal为要求的数据列,  以‘deptno’为分组的根据,即满足这个条件下才进行方差的操作,最后根据‘hiredate’进行排序。
              AS "VAR_POP",                                                   --方差
           VAR_SAMP (sal) OVER (PARTITION BY deptno ORDER BY hiredate)
              AS "VAR_SAMP"                                                 --样本方差
      FROM scott.emp
     WHERE deptno IN (20);
     
     /* Formatted on 5/24/2012 4:15:58 PM (QP5 v5.149.1003.31008) */
    SELECT deptno,
           STDDEV (sal)  AS "STDDEV", --标准差
           STDDEV_SAMP (sal)
              AS "STDDEV_SAMP",                                            --样本标准差
           VAR_POP (sal)
              AS "VAR_POP",                                                   --方差
           VAR_SAMP (sal)
              AS "VAR_SAMP"                                                 --样本方差
      FROM scott.emp
    group  by deptno

  • 相关阅读:
    我们的微信小程序开发
    node.js的模块引用
    关于 node.js的request事件
    关于 node.js 小插曲
    发给
    Kotlin 委托(1)类委托、变量委托注意事项
    Kotlin 扩展
    关于dex 64K 引用限制
    c++新特性实验(5)声明与定义:属性列表(C++11 起)
    apk反编译(6)用ProGuard 混淆、压缩代码,压缩资源。
  • 原文地址:https://www.cnblogs.com/AdaLoong/p/5595054.html
Copyright © 2011-2022 走看看