主知识点五:limit
【知识点引入】
select 字段名1
from 表格名
[where 条件代码]
[group by 字段名1]
[having 条件代码]
[order by 字段名 asc|desc]
limit n
【例题讲解】
【查询结果返回某几行】
点击链接分页查询employees表,每5行一页,返回第2页的数据_牛客题霸_牛客网
【总结】
【查询结果返回前n行】
- select 字段名1
- from 表格名
- [where 条件代码]
- [group by 字段名1]
- [having 条件代码]
- [order by 字段名 asc|desc]
- limit n
【查询结果返回x+1行到x+y行】
- select 字段名1
- from 表格名
- [where 条件代码]
- [group by 字段名1]
- [having 条件代码]
- [order by 字段名 asc|desc]
- limit x,y