Paging query
First, the scenario
data when you want to display, a display failure, need to submit sql paging request.
Two, sql grammar
select 查询列表 from 表
......
limit offset, size;
offset
: To display the starting index entry (starting index from 0);
size
: the number of entries to be displayed.
Third, the use case
-
Query before five employee information.
select * from employees limit 0, 5;
or
select * from employees limit 5;
-
Queries Article 25 Article 11 employee information.
select * from employees limit 10, 15;
Fourth, the use of features
- limit general statements on the final sql statements;
- The application layer paging query formula
page
: Indicates the number of pages to be displayed, that is, the first few pages;
size
: represents the number of each page to be displayed;
select * from table limit (page - 1) * size, size;