union 并(合并、相加,并且去重)
SQL> select * from scott.emp where deptno=20
2 union
3 select * from scott.emp where sal>2000;
union all 合并、相加不去重
SQL> select * from scott.emp where deptno=20
2 union all
3 select * from scott.emp where sal>2000;
intersect 交(返回两个结果集共有的部分)
SQL> select * from scott.emp where deptno=20
2 intersect
3 select * from scott.emp where sal>2000;
minus 补(相当于第一个结果集减第二个结果集)
SQL> select * from scott.emp where deptno=20
2 union
3 select * from scott.emp where sal>2000;
union all 合并、相加不去重
SQL> select * from scott.emp where deptno=20
2 union all
3 select * from scott.emp where sal>2000;
intersect 交(返回两个结果集共有的部分)
SQL> select * from scott.emp where deptno=20
2 intersect
3 select * from scott.emp where sal>2000;
minus 补(相当于第一个结果集减第二个结果集)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21175589/viewspace-755561/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21175589/viewspace-755561/