MySQL分页查询(limit用法)

来源:互联网 发布:荣耀盒子 软件 编辑:程序博客网 时间:2024/06/10 23:27
取前5条数据
[sql] view plain copy
  1. select * from table_name limit 0,5  

[sql] view plain copy
  1. select * from table_name limit 5  
取第11条到第15条数据,共5条

[sql] view plain copy
  1. select * from table_name limit 10,5  

limit关键字的用法:

LIMIT [offset,] rows

offset指定要返回的第一行的偏移量,rows第二个指定返回行的最大数目。初始行的偏移量是0(不是1)。

0 0
原创粉丝点击