使用的数据库:
https://blog.csdn.net/weixin_44953902/article/details/100169739
limit
-- 限制查询出来的数据个数
select * from students where gender=1 limit 2;
-- 查询5个数据
select * from students limit 0,5;
-- 查询id6-10(包含)的信息
select * from students limit 5,5;
-- 每页显示两个,第一个页面
select * from students limit 0,2;
-- 每页显示两个,第二个页面
select * from students limit 2,2;
-- 每页显示两个,第三个页面
select * from students limit 4,2;
-- 每页显示两个,第四个页面
select * from students limit 6,2;
-- limit (第N页-1)*每页的个数,每页的个数;
-- 每页显示两个,第六个页面,按照年龄从小到大
-- 失败 select * from students limit 2*(6-1),2;
-- 失败 select * from students limit 10,2 order by age asc;
select * from students order by age asc limit 10,2;
-- 查询所有的女性的信息并且按身高从高到低排序,只显示两个
select * from students where gender=2 order by high desc limit 2;