oracle 写法:
SELECT * FROM(select b.*,ROWNUM rn from (select a.* from table_name a order by hiredate) b) WHERE rn BETWEEN 5 AND 10;
sql server 写法:
SELECT TOP 11 * FROM table_name WHERE ID NOT IN (SELECT TOP 9 ID FROM table_name)
注:我的测试的数据库中起始id从1开始的,子查询代表查出前9条数据(1到9),外层查询即从第10条数据开始查询,查到第20条数据,即11条数据。
mysql 写法:
select * from table_name limit 9,10