取得薪水最高的前五名員工
sql:
select * from (
select empno,ename,sal from emp order by sal desc)
where
rownum< 6;
注意:
select * from (
table )
where
rownum< 6;
取前n條數據,oracle中用rownum < m;
1:其中m-1 等於要取的條數
2:rownum 只能有 < ,<= ,沒有 >
3: 如m為6,則取得是前5條數據。