当前位置:网站首页>Oracle analysis function over and MySQL achieve similar effects
Oracle analysis function over and MySQL achieve similar effects
2022-06-11 16:42:00 【Peach】
(1) Analysis function :
rank ( ) over ( [query_partition_clause]order_by_clause )
dense_rank ( ) over([query_partition_clause] order_by_clause )
rownumber ( ) over ([query_partition_clause]order_by_clause )
It can be sorted by the specified fields , Sort the result set of the same grouping field , among partition by For group fields ,order by Specify sort fields
over Not to be used alone , To sum up and analyze functions :rank(),dense_rank(),row_number() And so on
(2)Oracle Analyze the difference between functions and aggregate functions :
Analytic functions are used to calculate some aggregate value based on groups , It differs from the aggregate function in that it returns multiple rows for each group , The aggregate function returns only one line for each group .(3) The Works of Liezi
Ranking after grouping , example :
select* from
(
select a.*,row_number() over(PARTITION BY project_id order by task_Assign_time desc) asrId
fromrate_task_info a
)
where rId=1
(4)MySQL Implementation examples
SELECT * from(
select @rownum:[email protected]+1 rownum,a.*,
if(@objno=a.project_id or (@objno is null and a.project_id is null),
@rank:[email protected]+1,
@rank:=1) as row_number,
@objno:=a.project_id
from(SELECT * from rate_task_info where current_node=700 order by project_id,task_Assign_timedesc)a,
(select @rownum :=0,@objno:=null,@rank:=0)b
)t
where t.row_number=1;
边栏推荐
- 2022 molten welding and thermal cutting work license and simulation examination
- If you want to learn ArrayList well, it is enough to read this article
- 项目无法加载nacos配置中心的配置文件问题
- 【剑指Offer】21.调整数组顺序使奇数位于偶数前面
- LeetCode——42. 接雨水(双指针)
- 如何把树结构存储到数据库
- Time series prediction | MATLAB realizes future multi-step prediction of RBF RBF neural network time series
- 核密度估计(二维、三维)
- LeetCode——24. 两两交换链表中的节点(三指针)
- 2022 national question bank and mock examination for safety officer-b certificate
猜你喜欢

Pytest test framework Basics

web网页设计实例作业 ——河南美食介绍(4页) web期末作业设计网页_甜品美食大学生网页设计作业成品

Elasitcsearch basic learning notes (1)

Leetcode 1974. Minimum time to type words using a special typewriter (yes, once)

Analysis report on future development trend and investment suggestions of global and Chinese soybean protein industry 2022-2028

Common tools and commands for information collection

Katalon Studio Enterprise

Elasitcsearch基础学习笔记(1)

美团获得小样本学习榜单FewCLUE第一!Prompt Learning+自训练实战

GemBox.Bundle 43.0 Crack
随机推荐
select into from 和 insert into select 区别
R1 Quick Open Pressure Vessel Operation test Library and Simulation Test in 2022
WYSIWYG markdown editor: typora
Jinte Net Foundation will participate in the global strategy conference of dimension chain through online live broadcast
The micro service failed to connect to the cloud sentinel console and the link blank problem occurred after the connection was successful (resolved)
[ISITDTU 2019]EasyPHP
Time processing logic for the last 7 days, the last 10 days, and the last 90 days
List和Set存取元素的差异
MySQL quick start instance (no loss)
web安全-靶场笔记
Class and__ proto__ Property, the class prototype chain has two inheritance routes
微信小程序时间戳转化时间格式+时间相减
Weekly recommended short video: rookie CEO talks about the new logistics track in the future
如何把树结构存储到数据库
Analysis report on the "fourteenth five year plan" proposal and innovation environment of global and Chinese sodium pyrophosphate industry (2022-2028)
Analysis report on sales status and supply and demand prospects of phosphoric acid fuel cell industry in the world and China 2022-2028 Edition
RDKit教程
Rdkit installation
RSP: An Empirical Study of remote sensing pre training
Redis --- 学习 NoSQL 五大类型