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

Example Analysis of different query data before and after using rownum Paging sort

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces several examples of different query data before and after using rownum paging sorting, the article is very detailed, has a certain reference value, interested friends must read it!

1. Environment: creating a table

Create table test (id number, buydate timestamp)

Begin

For i in 1..10 loop

Insert into test values (iMagna Sysdate)

End loop

End

Select * from test

1 22-AUG-17 03.19.15.000000 PM

2 22-AUG-17 03.19.15.000000 PM

3 22-AUG-17 03.19.15.000000 PM

4 22-AUG-17 02.19.15.000000 PM

5 22-AUG-17 03.19.15.000000 PM

6 22-AUG-17 03.19.15.000000 PM

7 22-AUG-17 03.19.15.000000 PM

8 22-AUG-17 04.19.15.000000 PM

9 22-AUG-17 03.19.15.000000 PM

10 22-AUG-17 03.19.15.000000 PM

Use the rownum paging sort sql statement as follows:

-- 1

SELECT *

FROM (SELECT P.C., ROWNUM AS RN)

FROM (SELECT *

FROM TEST

WHERE 1 = 1

ORDER BY buydate DESC) P)

Where rn > 4 and rn

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