WEB开发网
开发学院数据库Oracle 示例详解Oracle 分组函数用法 阅读

示例详解Oracle 分组函数用法

 2013-02-23 10:57:11 来源:WEB开发网   
核心提示:90 2400020 13000110 1200080 14000---执行顺序:SELECT\FROM \ WHERE \GROUP BY \HAVING \ORDER BYSELECT JOB_ID, SUM(SALARY) PAYROLLFROM EMPLOYEES
90 24000
20 13000
110 12000
80 14000

-------执行顺序:SELECT\FROM \ WHERE \GROUP BY \HAVING \ORDER BY

SELECT JOB_ID, SUM(SALARY) PAYROLL
FROM EMPLOYEES
WHERE JOB_ID NOT LIKE '%REP%'
GROUP BY JOB_ID
HAVING SUM(SALARY) > 13000
ORDER BY SUM(SALARY);


JOB_ID PAYROLL
---------- ----------
PU_CLERK 13900
AD_PRES 24000
IT_PROG 28800
AD_VP 34000
ST_MAN 36400
FI_ACCOUNT 39600
ST_CLERK 55700
SA_MAN 61000
SH_CLERK 64300


-------------GROUP 函数的嵌套
最后一个示例:
SELECT MAX(AVG(SALARY))
FROM EMPLOYEES
GROUP BY DEPARTMENT_ID;


SELECT MAX(AVG(SALARY))
FROM EMPLOYEES
GROUP BY DEPARTMENT_ID;

上一页  1 2 3 

Tags:详解 Oracle 分组

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接