Reference Url: Https://Www.Bilibili.Com/video/BV12b411K7Zu?P=132
Scenario: When the data to be displayed, a display incomplete, paged submit SQL requests
grammar:
SELECT query list
FROM 表1
【join type join 表2
ON connection conditions
WHERE Filters
GROUP BY grouping field
HAVING screening grouped
ORDER BY sort fields]
LIMIT offset,size;
Offset to the starting index of the entries displayed (starting from index 0 start)
Size the number of entries to be displayed
Features:
1) limit statements in the last query
2) Official
The number of pages to be displayed Page , the number of entries per page size
SELECT query list
FROM 表
LIMIT (page-1)*size,size;
Case 1: Query before 5 Employee Information
SELECT * FROM employees LIMIT 0,5;
SELECT * FROM employees LIMIT 5;
Case 2: Query of 11 bar to section 25 Tiao
SELECT * FROM employees LIMIT 10,15;
Case 3: There are bonuses of employee information, and higher wages before 10 name display it
SELECT * FROM employees
WHERE commission_pct IS NOT NULL
ORDER BY salary DESC
LIMIT 0,10;