Create a new two table:
CREATE TABLE Guotest1
(
Sname VARCHAR2 (10),
Gender VARCHAR2 (10)
)
CREATE TABLE Guotest2
(
Sname VARCHAR2 (10),
Gender VARCHAR2 (10)
)
Insert data:
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 returns the difference set of two query result tables
For example: SELECT * from Guotest1 where rownum <= 4 minus select * from Guotest1 where rownum <= 2
return Result:
"Sname", "GENDER"
"C", "F"
"D", "F"
2 minus returned records always come from the table on the left
For example: SELECT * from Guotest1 minus select * from Guotest2
return Result:
"Sname", "GENDER"
"A", "M"
"B", "M"
"C", "F"
"D", "F"
This is like saying: If a record in the left table exists in the table on the right, the record does not return