语法
带有 LIMIT 子句的 SELECT 语句的基本语法如下
select column1,column2,columnN
from tableName
limit rows;
from tableName
LIMIT offset,rows; //(offset 和 rows是数字)
select column1,columnN
from tableName
LIMIT rows OFFSET offset; //(offset 和 rows是数字)
eg.
sqlite> select * from Person;
select * from Person;
id name
---------- ----------
1 Ansel
4 F
5 F
6 M
7 C
8 D
9 E
10 J
sqlite> select * from Person limit 3;
select * from Person limit 3;
id name
---------- ----------
1 Ansel
4 F
5 F
select * from Person limit 3,5;
id name
---------- ----------
6 M
7 C
8 D
9 E
10 J
select * from Person limit 3 offset 5;
id name
---------- ----------
8 D
9 E
10 J