SQL> SELECT avg(sal) FROM emp;
AVG(SAL)
2135
SQL> SELECT MIN(sal) FROM emp;
MIN(SAL)
800
SQL> SELECT MIN(sal) FROM emp;
MIN(SAL)
800
SQL> SELECT COUNT(*) FROM emp;
COUNT(*)-
15
SQL> select count(distinct deptno) from emp;
COUNT(DISTINCTDEPTNO)
3
SQL> select wm_concat(ename) from emp;
WM_CONCAT(ENAME)
EASON,G_EASON,ALLEN,WARD,JONES,MARTIN,BLAKE,CLARK,SCOTT,KING,TURNER,ADAMS,JAMES,
FORD,MILLER
SQL> SELECT deptno, avg(sal) from emp group by deptno;
DEPTNO AVG(SAL)
30 1566.66667
20 2312.5
10 2916.66667
SQL> SELECT deptno, job, avg(sal) from emp group by deptno, job;
DEPTNO JOB AVG(SAL)
20 CLERK 950
30 SALESMAN 1400
20 MANAGER 2975
30 CLERK 950
10 PRESIDENT 5000
30 MANAGER 2850
10 CLERK 1300
20 ANALYST 3000
10 MANAGER 2450
已选择9行。
SQL> select avg(sal) from emp group by deptno;
AVG(SAL)
1566.66667
2312.5
2916.66667
SQL> select deptno, WM_concat(ename) from emp group by deptno;
DEPTNO WM_CONCAT(ENAME)
10 CLARK,MILLER,KING
20 EASON,FORD,ADAMS,SCOTT,JONES,G_EASON
30 ALLEN,JAMES,TURNER,BLAKE,MARTIN,WARD
SQL> select deptno,avg(sal) from emp group by deptno having avg(sal) >2500;
DEPTNO AVG(SAL)
10 2916.66667
SQL> select deptno, avg(sal) from emp where deptno=10 group by deptno;
DEPTNO AVG(SAL)
10 2916.66667
SQL> select max(avg(sal)) from emp group by deptno;
MAX(AVG(SAL))
2916.66667
网站题目:Oracle专题6之Oracle的分组函数与数组分组
文章网址:https://www.cdcxhl.com/article0/ggjiio.html
成都网站建设公司_创新互联,为您提供静态网站、标签优化、品牌网站建设、网站改版、企业建站、搜索引擎优化
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联