zoukankan      html  css  js  c++  java
  • 多标联查-自连接

    4)自连接
      关联双方的表是同一个表。
     
      //查询员工编号,员工名,上级编号,上级名称
      select e.empno,e.ename,e.mgr,e1.ename
      from EMP e left outer join
           EMP e1 on(e.mgr=e1.empno);
    //查询员工编号,员工名,所在部门名,上级编号,上级名称
      select e.empno,e.ename,d.dname,e.mgr,e1.ename
      from EMP e
         left outer join EMP e1 on(e.mgr=e1.empno)
         left outer join DEPT d on(d.deptno=e.deptno);
  • 相关阅读:
    第四章的知识点:
    第一章的知识点:
    13
    12
    11
    10
    9
    zy
    金嘉琪 作业
    1022作业
  • 原文地址:https://www.cnblogs.com/yunman/p/5497562.html
Copyright © 2011-2022 走看看