行数制限

select * from tab1 order by col1 fetch first 3 rows only;
select * from tab1 order by col1 offset 2 rows fetch next 3 rows only;

select * from tab1 order by col1 limit 2;

select * from tab1 order by col1 limit 0 , 2;
select * from tab1 order by col1 limit 1 , 2;
select * from tab1 order by col1 limit 2 , 2;
select * from tab1 order by col1 limit 3 , 2;

 

create table tab1(col1 int);
insert into tab1 select generate_series(1,100,1);


select * from tab1 order by col1 limit 2;

select * from tab1 order by col1 limit 2 offset 3;

 

select top 10 * from tab1 order by col1
go

select * from tab1 order by col1 offset 1 rows
go

select * from tab1 order by col1 offset 1 rows fetch next 3 rows only
go