日期:2014-05-17 浏览次数:20764 次
SQL> create table a(name nvarchar2(30),no int);
Table created
SQL> create table b(name nvarchar2(30),no int);
Table created
SQL>
SQL> insert into a
2 select 'dc',1 from dual union select 'dw',2 from dual union select 'df',3 from dual;
3 rows inserted
SQL> insert into b
2 select 'dc',1 from dual union select 'dz',6 from dual union select 'ds',7 from dual;
3 rows inserted
SQL> select * from a;
NAME NO
------------------------ ---------------------------------------
dc 1
df 3
dw 2
SQL> select * from b;
NAME NO
------------------------ ---------------------------------------
dc 1
ds 7
dz 6
SQL> select * from b where not exists(select 1 from a where a.name=b.name);
NAME NO
------------------------ ---------------------------------------
ds 7
dz 6
SQL>