rownum: 1、虚拟的,查询的时候才虚拟出来的。表中实际不存在。
2、一般不能直接写>,只能直接写<
3、通过子查询,可以使用>
select rownum,empno,ename from emp where rownum <5 order by empno;
select b ,empno ,ename from (select rownum b,emp.* from emp) a where a.b>5 and a.b<10;
union:并集,去重
select * from (select * from emp where sal<1000 union select * from emp where sal <=2000)a order by empno;
union all:并集不去重
select * from (select * from emp where sal<1000 union all select * from emp where sal <=2000)a order by empno;
intersect:交集
select * from (select * from emp where sal<1000 intersect select * from emp where sal <=2000)a order by empno;
minus :差集
select * from (select * from emp where sal<2000 minus select * from emp where sal <=1000)a order by empno;