In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In previous versions, there were a variety of indirect means to get Top-N query results for top or bottom records. In 12c, the process is simplified and made more straightforward with a new FETCH FIRST | NEXT | PERCENT statement. Retrieve the top 10 salary records from the EMP table SQL > SELECT empno,ename,sal FROM emp ORDER BY SAL DESC FETCH FIRST 10 ROWS ONLY; EMPNO ENAME SAL 7839 KING 5000 7902 FORD 3000 7566 JONES 2975 7698 BLAKE 2850 7782 CLARK 2450 7499 ALLEN 1600 7844 TURNER 1500 7934 MILLER 1300 7521 WARD 1250 7654 MARTIN 1250
10 rows selected.
Original method
SQL > select * from (SELECT empno,ename,sal FROM emp ORDER BY SAL DESC) where rownum SELECT empno,ename,sal FROM emp ORDER BY SAL DESC offset 2 rows fetch next 3 rows only
EMPNO ENAME SAL 7566 JONES 2975 7698 BLAKE 2850 7782 CLARK 2450
Get the top 10% records from the EMP table
SQL > SELECT empno,ename,sal FROM emp ORDER BY SAL DESC FETCH FIRST 10 PERCENT rows only
EMPNO ENAME SAL 7839 KING 5000 7902 FORD 3000 get all similar records in the top 9 SQL > SELECT empno,ename,sal FROM emp ORDER BY SAL DESC FETCH FIRST 9 ROWS WITH TIES EMPNO ENAME SAL 7839 KING 5000 7902 FORD 3000 7566 JONES 2975 7698 BLAKE 2850 7782 CLARK 2450 7499 ALLEN 1600 7844 TURNER 1500 7934 MILLER 1300 7521 WARD 1250 7654 MARTIN 1250
10 rows selected.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.