比较实用的Oralce语句

基本伪列查询:

select * from (select rownum, e.* from emp e order by empno)  where rownum < 11;

 

select * from (select rownum r, e.* from emp e order by empno)  where r > 5    and r < 11;

汇总排名:

select emp.*, rank() over(order by sal desc) "工资排名" from emp;

select emp.*, rank() over(partition by deptno order by sal desc) "工资排名" from emp;

select * from (select e.*, rank() over(order by empno) emp_rank from emp e) where emp_rank = 3;

更多

 

posted on 2013-12-12 22:47  guarder  阅读(203)  评论(0编辑  收藏  举报