Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between oracle paging and mysql paging

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "what are the differences between oracle paging and mysql paging". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Differences: 1, oracle uses rownum for paging operation, rownum can only be less than, not greater, because this method is first queried and then sorted; 2, mysql uses limit for paging operation, parameter values in limit can not be written in the statement calculation expression, need to be calculated in advance.

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

What is the difference between oracle paging and mysql paging

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.

This is the end of the content of "what are the differences between oracle pagination and mysql pagination". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report