查询员工表中,工资排名在10-20之间的员工信息。
1select * 2 from( 3 select rownum rn ,employee_id,salary 4 from ( select employee_id,salary,last_name 5 from employees 6 order by salary desc) 7 ) 8where rn <=20 and rn >10
注意: 对 ROWNUM 只能使用 < 或 <=, 而用 =, >, >= 都将不能返回任何数据。
Wesley13
2021-10-11
查询员工表中,工资排名在10-20之间的员工信息。
1select * 2 from( 3 select rownum rn ,employee_id,salary 4 from ( select employee_id,salary,last_name 5 from employees 6 order by salary desc) 7 ) 8where rn <=20 and rn >10
注意: 对 ROWNUM 只能使用 < 或 <=, 而用 =, >, >= 都将不能返回任何数据。