-
在SQL语言基础中,涉及运用ALL操作符于子查询之中
资源介绍
在子查询中使用ALL操作符
*
EMPNO ENAME JOB
--------- ---------- ---------
7839 KING PRESIDENT
7566 JONES MANAGER
7902 FORD ANALYST
7788 SCOTT ANALYST
SQL> SELECT empno, ename, job
2 FROM emp
3 WHERE sal > ALL
4 (SELECT avg(sal)
5 FROM emp
6 GROUP BY deptno);
2916.6667
2175
1566.6667
*
SELECT empno, ename, job FROM emp WHERE sal > ALL
(SELECT avg(sal) FROM emp GROUP BY deptno);
Multiple-Row Subqueries (continued)
The ALL operator compares a value to every value returned by a subquery. The slide example displays employees whose salary is greater than the average salaries of all the departments. The highest average salary of a department is $2916.66, so the query returns those employees whose salary is greater than $2916.66.
>ALL means more than the maximum and
- 上一篇: NoSqlBooster5.1.4 新版
- 下一篇: 插入新行-SQL语言基础