oracle SQLServer MySql的分页实现

Oralce中用rownum(伪列)进行先排序再分配编号的方式进行分页:

select * from ( select rownum r,a from yourtable 
where rownum <= 20  order by name ) where r > 10 
这样取出第11-20条记录

 

SQLServer用row_num提供的编号进行分页:

select *from(select   row_number() over(order by ID desc) as rownum, id,name from table_1) where  rownum between 10 and 20  ;

 

 

MySql用limit分页函数:

select*from table_3 where  order by id limit  10,20;

 注:10表示从第十条开始查,每次查询20条

 

 

你可能感兴趣的:(Oracle SQL)