笨书网 + 

首页 »

在Oracle中怎样查询前10条记录?

作者:江门小程序开发 2023-12-10 15:41:52 / 472次阅读

根据时间条件排序,取前十条和后十条。

1、有时间字段, 根据时间条件排序,取前十条和后十条

(1)前十条:

select * from (select * from tab_name a order by date_col )

where rownum<11;

(2)后十条:

select * from (select * from tab_name a order by date_col  desc)

where rownum<11;

2、没有时间字段, 直接根据物理存储顺序,取前十条和后十条

(1)前十条:

select * from (select * from tab_name a order by rownum) 

where rownum<11;

(2)后十条:

select * from (select * from tab_name a order by rownuml  desc) 

where rownum<11;

想了解更多关于在Oracle中怎样查询前10条记录?的内容,请扫微信
或微信搜索jiemingpan

本文链接:https://www.benshu.com/p/716111

版权说明:本文版权由作者自行负责,如有侵权请联系本站删除。

相关文章


前一篇: input元素所有type类型及相关作用
后一篇: 啦啦啦是什么歌

栏目精选


笨书网仅提供信息存储服务,内容由用户上传发布,如果侵犯了您的权益,请及时联系我们,核实后24小时内处理或删除。
Copyright © 2020 笨书网  备案号:粤ICP备15074009号

go to top