在子查询中使用ALL操作符-SQL语言基础

时间:2024-05-15 13:25:03
【文件属性】:

文件名称:在子查询中使用ALL操作符-SQL语言基础

文件大小:5.26MB

文件格式:PPT

更新时间:2024-05-15 13:25:03

SQL 基础

在子查询中使用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


网友评论