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

Comparison of paging query between Mysql and Oracle

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MySql paging query statement

The index of m for the number of rows in the following query statement starts at 0 by default, similar to cursor 0 in pl/sql, which indicates how many pieces of data are queried backward from the first line.

For example:

Select * from emp limit 2Pol 3 means to query the third piece of data to the sixth piece of data (before and after the package), that is, the third piece of data includes the third piece of data and does not include the sixth piece of data, that is, 3,4jue 5 records.

Select * from buss_stu_info limit mjinn

Paging query of Oracle database

One-tier paging query:

When the amount of data is large enough and the query speed is almost unaffected, the query rate is fast enough. Generally, when writing this kind of sql statement, the individual divides the sql statement into two layers, the inner layer and the outer layer, which is less than the maximum in the inner layer and greater than the minimum in the outer layer. (you set the maximum and minimum)

Select * from (select rownum as rn,empno,ename from emp e where rownum5

Two-tier paging query:

The paging query statement of Oracle can basically be applied according to the format given in this article.

Paging query format:

SELECT *

FROM (SELECT a.mom, ROWNUM rn)

FROM (SELECT *

FROM table_name) a

WHERE ROWNUM = 21

The innermost query SELECT * FROM TABLE_NAME represents the original query statement that does not turn the page. ROWNUM = 21 controls the scope of each page of the paging query.

The paging query given above is efficient in most cases. The purpose of paging is to control the size of the output result set and return the results as soon as possible. In the paging query above, this consideration is mainly reflected in WHERE ROWNUM

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