//table1和table2为两个测试表 随便插入几条数据 SQL> select * from table1; ID NAME ---------- -------------------- 1 wh 2 wp 3 wq SQL> select * from table2; ID NAME ---------- -------------------- 4 wr 1 wh //正常查询 SQL> select a.name,b.name 2 from table1 a,table2 b 3 where a.id=b.id; NAME NAME -------------------- -------------------- wh wh //显示出table1中的所有记录 table2中无相应记录则置NULL SQL> select a.name,b.name 2 from table1 a,table2 b 3 where a.id=b.id(+); NAME NAME -------------------- -------------------- wh wh wq wp //显示出table2中的所有记录 table1中无相应记录则置NULL SQL> select a.name,b.name 2 from table1 a,table2 b 3 where a.id(+)=b.id; NAME NAME -------------------- -------------------- wh wh wr //呵呵,这里本想尝试一下全外连接,不过使用(+)好像不行 SQL> select a.name,b.name 2 from table1 a,table2 b 3 where a.id(+)=b.id(+); where a.id(+)=b.id(+) * ERROR at line 3: ORA-01468: a predicate may reference only one outer-joined table
ORACLE外连接小结~ http://blog.csdn.net/wh62592855/article/details/4852908
最新推荐文章于 2024-07-06 13:58:06 发布