在Oracle中创建表时使用NOT EXISTS

时间:2015-10-07 15:51:03

标签: sql oracle oracle11g

create table wholetable as 
(
    select t1.column1 , t1.column2 from t1
    minus
    select t2.column1, t2.column2 from t2
)

我可以修改此查询以使用NOT EXISTS代替MINUS吗?

1 个答案:

答案 0 :(得分:2)

是的,你可以:

create table wholetable as
select t1.column1, t1.column2
  from t1
 where not exists (select *
                     from t2
                    where t2.column1 = t1.column1
                      and t2.column2 = t1.column2)