sql查询 —— 分页

-- 分页
      -- limit
      -- limit start count    (start 显示骑士值,单页数量)
      select *from student where gender=1 limit 6,3;

      -- 分页
      -- 以3行为一页,分页
      -- 第一页
      select *from student limit 0,3;
      -- 第二页
      select *from student limit 3,3;
      -- 第三页
      select *from student limit 6,3;
      -- 分页式   limit(第n页-1)*count ,count

      -- 查询所有男性, 2个数据为一页,以年龄倒序
      select *from student where gender=1 order by age desc limit 0,2;

      --  limit 始终要在最后
      --失败 select *from student where gender=1 limit 0,2 order by age desc ;
      -- limit 不支持数学表达式
      -- 失败 显示第三页  select *from student where gender=1 limit (3-1)*2,2

 

posted @ 2019-07-24 01:29  jum_blog  阅读(207)  评论(0编辑  收藏  举报

载入天数...载入时分秒...