In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The Analytical function of oracle Rookie Learning-sorting function
1.row_number: returns a continuous sort, regardless of whether the values are equal or not
2.rank: the order is the same with equal value, and the ordinal value then jumps
3.dense_rank: with equality, the rows are sorted in the same order, and the sequence number is consecutive.
Experimental tables: create table chengji (sno number,km varchar2 (10), score number); insert into chengji values (1 recorder YWP 60); insert into chengji values (2 Med YWP 70); insert into chengji values (2 Med YWP 70); insert into chengji values (3 Med YWH 80); SQL > select * from chengji SNO KM SCORE- 1 YW 60 1 SX 60 1 YY 60 2 YW 70 2 SX 70 3 YW 80 1 YW 60 1 SX 60 1 YY 60 2 YW 70 2 SX 70 SNO KM SCORE- 3 YW 8012 rows selected.SQL > row_number
Format: row_number () over ()
Sorting is similar to ranking. If the values of An and B are both 100, then the sort of An is 1 and the sort of B is 2.
SQL > select sno,km,score,row_number () over (order by score desc) from chengji SNO KM SCORE ROW_NUMBER () OVER (ORDERBYSCOREDESC)-3 YW 80 1 3 YW 80 2 2 YW 70 3 2 YW 70 4 2 SX 70 5 2 SX 70 6 1 SX 60 7 1 YY 60 8 1 SX 60 9 1 YW 60 10 1 YY 60 11 SNO KM SCORE ROW_NUMBER () OVER (ORDERBYSCOREDESC)- -1 YW 60 1212 rows selected.SQL > rank
Ranking is similar to ranking. If the values of An and B are both 100, then the order of An is 1 Magi B, the order of 1 Magi C is 3.
SQL > select sno,km,score,rank () over (order by score desc) from chengji SNO KM SCORE RANK () OVER (ORDERBYSCOREDESC)-3 YW 80 1 3 YW 80 1 2 YW 70 3 2 YW 70 3 2 SX 70 3 2 SX 70 3 1 SX 60 7 1 YY 60 7 1 SX 60 7 1 YW 60 71 YY 60 7 SNO KM SCORE RANK () OVER (ORDERBYSCOREDESC)-1 YW 60 712 rows selected.SQL > dense_rank
Sorting is similar to ranking. If the values of An and B are both 100, then An is sorted as 1 Magi B, and 1 Magi C is sorted as 2.
SQL > select sno,km,score,dense_rank () over (order by score desc) from chengji SNO KM SCORE DENSE_RANK () OVER (ORDERBYSCOREDESC)-3 YW 80 1 3 YW 80 1 2 YW 70 2 2 YW 70 2 2 SX 70 2 2 SX 70 2 1 SX 60 3 1 YY 60 3 1 SX 60 3 1 YW 60 3 1 YY 60 3 SNO KM SCORE DENSE_RANK () OVER (ORDERBYSCOREDESC)- -1 YW 60 312 rows selected.SQL >
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.