【MySql】Limit基本用法

limit通常用做页面分页使用

--查询从第0行开始取5行数据
Selcet * from table limit 0,5;

--查询从第5行开始取5行数据
Select * from table limit 5,5;


--如果要查的字段没有加索引,为了避免全表扫描,增加查询速度
Select * from table Where phone=1831234567 limit 1;

--如果要查的表数据跨越比较大
Select * from table limit 99999,100 --不建议
Select * from table id>=99999 limit 100 --建议



猜你喜欢

转载自blog.csdn.net/xudahai513/article/details/126564317