# Advanced 8: paging query ★
/ *
Scenario: When the data to be displayed, a display incomplete, paged through a request submitted sql
syntax:
the SELECT list of queries
from table
[join type join in Table 2
ON connection conditions
where Filters
group by group field
screening after having grouped
order by ordering fields]
; limit [offset,] size
offset to be displayed starting index entry (starting index from zero)
the number of entries to display size
: features
①limit statements in the query last
② formula for
the number of pages to be displayed page, the number of entries per page size
the SELECT list of queries
from table
limit (Page-1) * size, size;
size = 10
Page
1 0
2 10
3 20
* /
# case 1: query first five employee information
SELECT * FROM employees LIMIT 0,5;
SELECT * FROM employees LIMIT 5;
Case # 2: Query Article 11 - Article 25
SELECT * FROM employees LIMIT 10,15;
Case # 3: There are bonuses of employee information, and higher wages appear before 10
the SELECT
*
the FROM
the Employees
the WHERE IS commission_pct the NOT NULL
the ORDER BY salary DESC
LIMIT 10;