Oracle paging query tutorial and oracle paging tutorial
SELECT *
FROM (select rownum as rowno, t .*
FROM table t where rownum <= page * size) table_aliasWHERE table_alias.rowno> (page-1) * size;
Page with order by statement: SELECT *
FROM (select rownum as rowno, r .*
FROM (SELECT * FROM table t
Order by t. element asc
) R
Where ROWNUM <= page * size
) Table_alias
WHERE table_alias.rowno> (page-1) * size;
The upper limit condition must be placed in the subquery, and the lower limit condition must be placed in the outer query (rownum always starts from 1. If the first condition does not meet the condition, the rownum of the second row becomes 1 ).
By the way, the SQL format for querying by page in MySql is: select * from table limit m, n;
Where m is the start page number of each page, n is the number of lines displayed per page, m = (pageNum-1) * n