登录 注册
当前位置:主页 > 资源下载 > SQL语言基础中的多行子查询

SQL语言基础中的多行子查询

  • 更新:2024-07-07 11:58:44
  • 大小:5.26MB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:Informix - 数据库
  • 格式:PPT

资源介绍

多行子查询 * 操作符 IN ANY ALL 含义 等于列表中的某一个值 与列表中的任意值比较 与列表中的所有值相比较 返回值多于一行 使用多行比较操作符 * Multiple-Row Subqueries Subqueries that return more than one row are called multiple-row subqueries. You use a multiple-row operator, instead of a single-row operator, with a multiple-row subquery. The multiple-row operator expects one or more values. Example Find the employees who earn the same salary as the minimum salary for departments. The inner query is executed first, producing a query result containing three rows: 800, 950, 1300. The main query block is then processed and uses the values returned by the inner query to complete its search condition. In fact, the main query would look like the following to the Oracle Server: SQL> SELECT ename, sal, deptno 2 FROM emp 3 WHERE sal IN (SELECT MIN(sal) 4 FROM emp 5 GROUP BY deptno); SQL> SELECT ename, sal, deptno 2 FROM emp 3 WHERE sal IN (800, 950, 1300);