新建两个表:
create table guotest1
(
sname varchar2(10),
gender varchar2(10)
)
create table guotest2
(
sname varchar2(10),
gender varchar2(10)
)
插入数据:
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返回的是两个查询结果表的差集
例如:select * from guotest1 where rownum <= 4 minus select * from guotest1 where rownum <= 2
返回结果:
sname,gender
c,f
d,f
2 minus返回的记录总是来自于左边的表
例如:select * from guotest1 minus select * from guotest2
返回结果:
sname,gender
a,m
b,m
c,f
d,f
像是说:如果左边的表中的某个记录存在于右边的表中,则该记录不会返回
更多信息请查看IT技术专栏