登录 注册
当前位置:主页 > 资源下载 > SQL语言基础中包含对外连接的使用

SQL语言基础中包含对外连接的使用

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

资源介绍

使用外连接 * SQL> SELECT e.ename, d.deptno, d.dname 2 FROM emp e, dept d 3 WHERE e.deptno(+) = d.deptno 4 ORDER BY e.deptno; ENAME DEPTNO DNAME ---------- --------- ------------- KING 10 ACCOUNTING CLARK 10 ACCOUNTING ... 40 OPERATIONS 15 rows selected. * SELECT e.ename, d.deptno, d.dname FROM emp e, dept d WHERE e.deptno(+) = d.deptno ORDER BY e.deptno; Returning Records with No Direct Match with Outer Joins (continued) The slide example displays numbers and names for all the departments. The OPERATIONS department, which does not have any employees, is also displayed. Outer Join Restrictions The outer join operator can appear on only one side of the expression—the side that has information missing. It returns those rows from one table that have no direct match in the other table. A condition involving an outer join cannot use the IN operator or be linked to another condition by the OR operator. 全外连接: SELECT e.ename, d.deptno, d.dname FROM emp e FULL OUTER JOIN dept d on (e.deptno=d.deptno) ORDER BY e.deptno; Instructor Note Demo: l4ojoin.sql Purpose: To illustrate an outer join.