postgresql 使用limit分页
2012-08-10 11:21
337 查看
SELECT select_list FROM table_expression [ ORDER BY ... ] [ LIMIT { number | ALL } ] [ OFFSET number ]
举例:select * from userinfo limit 10 offset 3 选出的是4-13条记录。没有经过orderby,多次执行语句可能结果不同;经过orderby则结果相同。
If a limit count is given, no more than that many rows will be returned.
返回不多于limit的条数
OFFSET says to skip that many rows before beginning to return rows.
跳过前offset条数
If both OFFSET and LIMIT appear, then OFFSET rows are skipped before starting to count the LIMIT rows that are returned.
二者一起用时offset跳过后开始数limit
using different LIMIT/OFFSET values to select different subsets of a query result will give inconsistent results unless you enforce a predictable result ordering with ORDER BY. This is not a bug; it is an inherent consequence of the fact that SQL does not promise to deliver the results of a query in any particular order unless ORDER BY is used to constrain the order.
只用offset和limit会导致多次查询结果不同,用orderby可以避免,但是这不是bug
相关文章推荐
- postgresql和mysql中的limit使用方法
- laravel 自定义分页 offset 和 limit 的使用
- 在MySQL中使用LIMIT进行分页的方法
- laravel 自定义分页 offset 和 limit 的使用
- mybatis进行分页,使用limit
- 【postgresql】在postgresql中使用limit实现select top x
- postgreSQL数据库limit分页、排序
- 使用mysql的limit进行分页时出现重复问题
- 转MongoDB 使用Skip和limit分页
- 使用子查询提高MySQL分页效率 limit
- mysql使用limit来实现分页查询
- 随手记--js页面分页(不需要后台mySql使用limit)
- MySQL数据分页查询---limit、order by的使用
- MongoDB 使用Skip和limit分页
- mysql数据库Limit分页使用
- MongoDB 使用Limit和Skip完成分页 和游标(二)
- Mysql使用limit关键字分页查询
- 在postgresql中使用limit实现select top x
- mysql大数据量使用limit分页,随着页码的增大,查询效率越低下。(转载)
- mysql大数据量使用limit分页,随着页码的增大,查询效率越低下。