ORACLE笔试题:存在表T(a,b,c,d),要根据字段c排序后取第21—30条记录显示,请给出sql
3个回答
展开全部
1.select * from (select c.*,rownum as rn from (select * from t order by c desc) c) where rn between 21 and 30;
2.select * from (select * from test order by c desc) x where rownum < 30
minus
select * from (select * from test order by c desc) y where rownum < 20 order by 3 desc
二者相比,下边的Minus性能稍差。
2.select * from (select * from test order by c desc) x where rownum < 30
minus
select * from (select * from test order by c desc) y where rownum < 20 order by 3 desc
二者相比,下边的Minus性能稍差。
展开全部
SELECT
a, b, c, d
FROM
(SELECT rownum AS no, a,b,c,d FROM T ORDER BY c) as tmpView
WHERE
no >= 21 AND no <30
a, b, c, d
FROM
(SELECT rownum AS no, a,b,c,d FROM T ORDER BY c) as tmpView
WHERE
no >= 21 AND no <30
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
SELECT a,b,c,d FROM T ORDER BY c DESC LIMIT 20,10
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询