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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。