当前位置:网站首页>Paging SQL (rownum, row_number, deny_rank, rank)
Paging SQL (rownum, row_number, deny_rank, rank)
2022-06-29 15:23:00 【Game programming】
Pseudo column :rownum It is oracle Database built-in columns , Any table can use , It is used to display the row number of data in the table
rownum principle
(1) For base tables , stay insert Records are allocated in the order of insertion
(2) For subqueries , Display in the query order of the subquery
A simple example
---- Check out the lowest paid 5 Employee information select t.*,ROWNUM from (select emp.* from emp order by sal) twhere ROWNUM between 1 and 5;select t.*,ROWNUM from (select emp.* from emp order by sal) twhere ROWNUM in(1,2,3,4,5);select t.*,ROWNUM from (select emp.* from emp order by sal) twhere ROWNUM<=5;The operation effect is as follows :

notes :
- rownum Can only be less than 、 Less than or equal to a certain number 、 be equal to 1、 Greater than or equal to 1、 be equal to 1
rownum There are... For dynamic allocation 1 There are subsequent serial numbers , namely rownum Not greater than 1 namely 1 The number above and rownum Can not be equal to 1 The number above
Tuo
row_number(): Need and over The windowing function is used in conjunction with , Sequence number of the sort and rownum Pseudo columns are the same , Serial number , Regardless of the equality of values ( Same value but different sequence number )
dense_rank(): It can be used to sort , Its serial number is continuous , Consider duplicate data , If the values are equal, the sequence number is the same
rank(): It can be used to sort , Its serial number is discontinuous , Consider duplicate data , If the values are equal, the sequence numbers are the same
select e.*,row_number() over(order by sal desc) r from emp e;select e.*,dense_rank() over(order by sal desc) r from emp e;select e.*,rank() over(order by sal desc) r from emp e;select e.*,row_number()over(partition by deptno order by sal desc) r from emp e;The operation effect is as follows :


author : Yun Wenwu
Game programming , A game development favorite ~
If the picture is not displayed for a long time , Please use Chrome Kernel browser .
边栏推荐
- 从雷达回波中可获取的信息
- 动态监听DOM元素高度变化
- Wechat official account - menu
- 西北工业大学遭境外电邮攻击
- Is Guangzhou futures regular? If someone asks you to log in with your own mobile phone and help open an account, is it safe?
- 真正的软件测试人员 =“半个产品+半个开发”?
- BioVendor遊離輕鏈(κ和λ)Elisa 試劑盒的化學性質
- Unity C basic review 29 - Generic delegation (p451)
- 知识点:PCB线路板布线都有哪些诀窍?
- MCS: discrete random variable - binomial distribution
猜你喜欢

SOFARegistry 源码|数据同步模块解析

Render follows, encapsulating a form and adding data to the table

第九章 APP项目测试(此章完结)

关于SQL+NoSQL : NewSQL数据库

Informatics Olympiad all in one 2061: trapezoidal area

分页sql(rownum、row_number、dense_rank、rank)

深度学习遥感数据集

Unity C# 基础复习26——初识委托(P447)

For example, the visual appeal of the live broadcast of NBA Finals can be seen like this?

MCS:多元随机变量——离散随机变量
随机推荐
Lumiprobe 活性染料丨羧酸:Sulfo-Cyanine7.5羧酸
雷达的类型
Real software testers = "half product + Half development"?
中序和后序遍历构建二叉树[递归划分区间与回溯拼接子树+中后序和中前序的相似与不同]
ROS notes (10) - Launch file startup
c#Sqlite类库
PyTorch 二维多通道卷积运算方式
MySQL 数据库命名规范.PDF
Pytorch two-dimensional multi-channel convolution operation method
又拍云 Redis 的改进之路
材质 动态自发光
MySQL定时整库备份&滚动删除指定日期前的备份数据
Lumiprobe click chemistry - non fluorescent azide: azide-peg3-oh
js获取上个月第一天以及本月的最后一天
第九章 APP项目测试(4) 测试工具
遥感典型任务分析
JS 会有变量提升和函数提升
信息学奥赛一本通1194:移动路线
MCS: discrete random variable Poisson distribution
适用于遥感图像处理的神经网络