手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

postgreSQL数据库limit分页、排序

时间:2024-10-26 04:20:57

po衡痕贤伎stgreSQL数据库limit分页、排序

语法:

select*frompersonslimitAoffsetB;

解释:

A就是你需要多少行;

B就是查询的起点位置。

示例:

select*frompersonslimit5offset0;

意思是,起点0开始查询,返回5条数据。

postgreSQL数据库limit分页、排序

select*frompersonslimit5offset5;

意思是,起点5开始查询,返回5条数据。

postgreSQL数据库limit分页、排序

特殊:

select*frompersonslimit5;

这个就类似:

select*frompersonslimit5offset0;

也就是,从起点0开始查询,返回5条数据。

按规则排序,同时也要分页:

select*frompersons

orderbylastname

limit5offset0;

© 手抄报圈