• AVG


    AVG([ DISTINCT | ALL ] expr) [ OVER(analytic_clause) ]


     SELECT MANAGER_ID,
               LAST_NAME,
               HIRE_DATE,
               SALARY,
               AVG(SALARY) OVER(PARTITION BY MANAGER_ID ORDER BY HIRE_DATE ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS C_MAVG
          FROM EMPLOYEES
         WHERE MANAGER_ID BETWEEN 101 AND 108
         ORDER BY MANAGER_ID, HIRE_DATE, SALARY;


    MANAGER_ID LAST_NAME         HIRE_DATE       SALARY     C_MAVG
    ---------- ------------------------- ----------- ---------- ----------
           101 Mavris                    2002/6/7       6500.00       8250
           101 Baer                      2002/6/7      10000.00 9502.66666
           101 Higgins                   2002/6/7      12008.00 11338.6666
           101 Greenberg                 2002/8/17     12008.00       9472
           101 Whalen                    2003/9/17      4400.00       8204
           102 Hunold                    2006/1/3       9000.00       9000
           103 Austin                    2005/6/25      4800.00       4800
           103 Pataballa                 2006/2/5       4800.00       4600
           103 Lorentz                   2007/2/7       4200.00       5000
           103 Ernst                     2007/5/21      6000.00       5100
           108 Faviet                    2002/8/16      9000.00       8600
           108 Chen                      2005/9/28      8200.00       8300
           108 Sciarra                   2005/9/30      7700.00       7900
           108 Urman                     2006/3/7       7800.00 7466.66666
           108 Popp                      2007/12/7      6900.00       7350
    15 rows selected

  • 相关阅读:
    JQ和Js获取span标签的内容
    JS获取子节点、父节点和兄弟节点的方法实例总结
    JS实现系统时间(自动)
    CSS font-family 属性
    网页中导入特殊字体@font-face属性详解
    ****HTML模板资源汇总
    ***XAMPP:报错 Unable to load dynamic library的解决方法
    2016年宜昌楼市将迎来史上最激烈一战
    北大资源重磅来宜--宜昌未来商业中心将诞生
    HTML5调用传感器的资料汇总
  • 原文地址:https://www.cnblogs.com/wwxbi/p/4176632.html
Copyright © 2020-2023  润新知