1z0-071 Oracle Database 12c SQL 第9题 WITH TIES关键字

Q9. You want to display 5 percent of the rows from the SALES table for products with the lowest AMOUNT_SOLD and also want to include the rows that have the same AMOUNT_SOLD even if this causes the output to exceed 5 percent of the rows.
Which query will provide the required result?
A. SELECT prod_id, cust_id, amount_sold
FROM sales
ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS WITH TIES;
B. SELECT prod_id, cust_id, amount_sold
FROM sales
ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS ONLY WITH TIES;
C. SELECT prod_id, cust_id, amount_sold
FROM sales
ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS WITH TIES ONLY;
D. SELECT prod_id, cust_id, amount_sold
FROM sales
ORDER BY amount_sold

FETCH FIRST 5 PERCENT ROWS ONLY;

Correct Answer: A

参考:http://www.itpub.net/thread-1801753-1-1.html

http://oraclescan.blogspot.com/2015/12/row-limiting-clause-for-top-n-queries.html

http://www.oratea.com/2017/02/10/oracle12c%E6%96%B0%E7%89%B9%E6%80%A7-%E5%88%86%E9%A1%B5%E6%9F%A5%E8%AF%A2top-n-sql/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值