温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

12C SQL-TOP

发布时间:2020-08-06 20:07:10 来源:ITPUB博客 阅读:145 作者:xuexiaogang 栏目:关系型数据库
在刚才的基础上。


insert into look values (2,'a',100);
insert into look values (3,'a',100);
insert into look values (4,'a',100);
insert into look values (5,'a',100);
insert into look values (6,'a',100);
insert into look values (7,'a',100);
insert into look values (8,'a',100);
insert into look values (9,'a',100);
insert into look values (10,'a',100);
insert into look values (11,'a',100);
insert into look values (12,'a',100);
insert into look values (13,'a',100);
insert into look values (14,'a',100);
insert into look values (15,'a',100);
insert into look values (16,'a',100);
insert into look values (17,'a',100);
insert into look values (18,'a',100);
insert into look values (19,'a',100);
insert into look values (20,'a',100);


SELECT * FROM look ORDER BY id DESC FETCH FIRST 3 ROWS ONLY;

SQL> SELECT * FROM look ORDER BY id DESC FETCH FIRST 3 ROWS ONLY;


ID NAME   MONEY
---------- ---------- ----------
20 a     100
19 a     100
18 a     100

排名前三的


SQL> SELECT * FROM look  ORDER BY id DESC FETCH FIRST 10 PERCENT ROWS ONLY;

ID NAME   MONEY
---------- ---------- ----------
20 a     100
19 a     100

排名前10%的

SQL> SELECT * FROM look  ORDER BY id DESC OFFSET 5 ROWS FETCH NEXT 5 ROWS ONLY;

ID NAME   MONEY
---------- ---------- ----------
15 a     100
14 a     100
13 a     100
12 a     100
11 a     100
忽略前5条记录并会显示表的下5条记录:

SELECT * FROM look ORDER BY id FETCH FIRST 5 PERCENT ROWS WITH TIES;  

ID NAME   MONEY
---------- ---------- ----------
1 a     100




向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI