Analysis of the difference between Oracle and Mysql pagination
1. Mysql uses limit paging
Select * from stu limit m, n; / m = (startPage-1) * pageSize,n = pageSize
PS:
(1) the first parameter value m represents the starting line, and the second parameter indicates how many rows are taken (page size)
(2) m = (2-1) * 10 ~ 1, which means that limit 11 ~ 10 starts at 11 lines and takes 10 rows, that is, page 2 data.
(3) the values of m and n parameters cannot be written in the statement, and the values must be calculated before they are written to the statement.
2. Oracle uses rownum for paging
Select * from (select rownum rn,a.* from table_name a where rownum = y; / / starting line, y = (startPage-1) * pageSize+1
PS:
(1) > = y rownum 1, when the first piece of data is queried and the value is 1, the condition is not met. Second, third. Similarly, the condition has not been met, so the result has not been returned. So when you query, you need to set an alias, and then call the alias to determine if the alias is greater than the value after the query is completed.
Summary
The above is the difference between Oracle and Mysql pages introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave a message for me, and the editor will reply you in time. Thank you very much for your support to the website!