知识库logo

Oracle 常用分页

日期:2023-07-26

1、通过MINUS分页

SELECT * FROM STU WHERE ROWNUM < 3 MINUS SELECT * FROM STU WHERE ROWNUM < 2

2、通过ROWNUM分页

SELECT * FROM STU WHERE ROWNUM < 10

查询前10条

SELECT * FROM (SELECT * FROM STU) WHERE ROWNUM <= 10

3、通过BETWEEN分页 (查询1到10)

SELECT * FROM STU WHERE ROWNUM BETWEEN 1 AND 10

SELECT * FROM (SELECT a.*,ROWNUM RN FROM STU) WHERE RN <=10

其它相关知识

跳转到在线服务平台