新人自学oracle,看到好多查询语句都那样写,是有什么特别的用处啊?请高人指点

解决方案 »

  1.   

    左连接和右连接+写左边为右连接,相当于right join+写右边为左连接,相当于left join
      

  2.   


    例:select t1.*,t2.* from a表,b表 where a.id(+)=b.id
    (+)号在左边表示查询出来的记录数以右边表(即 b表)的记录数为准 
      

  3.   

    左连接和右连接+写左边为右连接,相当于right join+写右边为左连接,相当于left join
      

  4.   

    建议用right join 和left join 写左右连接
      

  5.   

    关于左右外连接参考这个
    http://blog.csdn.net/cchaha/archive/2009/09/08/4530838.aspx
      

  6.   

    1. 内连接很简单
    select A.*, B.* from A,B where A.id = B.id
    select A.*, B.* from A inner join B on A.id = B.id2. 左外连接
    select * from emp a left join dept d on a.deptno=d.deptno
    select * from emp a,dept d where a.deptno=d.deptno(+) 
    3. 右外连接
    select * from emp a right join dept d on a.deptno=d.deptno
    select * from emp a,dept d where a.deptno(+)=d.deptno
      

  7.   

    +号加在那边,表示那列没有匹配的,要加上NULL 
      

  8.   

    外连接,ORACLE 9I及其之前的写法
      

  9.   

    列1=列2(+) 左外连接 ,列1值为null的行也能查询的到
    (+)连接符放在想查询的行中包含空值的列(列1)相反的一边 (列2)
      

  10.   


       左连接和右连接+写左边为右连接,相当于right join+写右边为左连接,相当于left join