Oracle rownum usage and pgsql limit offset usage

1. The usage of oracle rownum and the usage of pgsql limit offset

1. Oracle rownum can be used to limit rows and be used for paging

select * from (
 select rownum r,a.* from table a
 )t  where r > 5 and r<7;

2. Pgsql limits the number of rows and the available limit or offset for paging

--当查询具体某行时,可直接利用offset,注意第一行的offset是0
--以下sql为从第二行开始到第三行的数据获取,可用于分页
select * from test limit 2 offset 1;
--以下sql为从头开始的两条数据
select * from test limit 2


Guess you like

Origin blog.csdn.net/sunxiaohong__/article/details/128230918