有关oracle 9i中的内连接,左外连接,右外连接问题                     

1. 内连接很简单
select A.*, B.* from A,B where A.id = B.id
select A.*, B.* from A inner join B on A.id = B.id
以上两句是完全等价的

2. 左外连接
select distinct(p.person_id) from t_pbase_info p, t_pcontact_info c where p.person_id = c.person_id(+)
select distinct(p.person_id) from t_pbase_info p left join t_pcontact_info c on p.person_id = c.person_id
以上两句是完全等价的

3. 右外连接
select distinct(p.person_id) from t_pbase_info p, t_pcontact_info c where p.person_id(+) = c.person_id
select distinct(p.person_id) from t_pbase_info p right join t_pcontact_info c on p.person_id = c.person_id
以上两句是完全等价的

也就是说在oracle中+号放在=右边相当于左连接,而+号放在=左边相当于右连接



久久不醉