新建兩個(gè)表:
create table guotest1
(
sname varchar2(10),
gender varchar2(10)
)
create table guotest2
(
sname varchar2(10),
gender varchar2(10)
)
插入數(shù)據(jù):
insert into guotest1 values('a', 'm');
insert into guotest1 values('b', 'm');
insert into guotest1 values('c', 'f');
insert into guotest1 values('d', 'f');
insert into guotest2 values('e', 'm');
insert into guotest2 values('f', 'm');
insert into guotest2 values('g', 'f');
insert into guotest2 values('h', 'f');
1 minus返回的是兩個(gè)查詢(xún)結(jié)果表的差集
例如:select * from guotest1 where rownum <= 4 minus select * from guotest1 where rownum <= 2
返回結(jié)果:
sname,gender
c,f
d,f
2 minus返回的記錄總是來(lái)自于左邊的表
例如:select * from guotest1 minus select * from guotest2
返回結(jié)果:
sname,gender
a,m
b,m
c,f
d,f
像是說(shuō):如果左邊的表中的某個(gè)記錄存在于右邊的表中,則該記錄不會(huì)返回
更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄