当前位置:网站首页>阿里天池SQL训练营学习笔记5
阿里天池SQL训练营学习笔记5
2022-06-30 18:16:00 【游戏编程】
本笔记为阿里云天池龙珠计划SQL训练营的学习内容,链接为:https://tianchi.aliyun.com/specials/promotion/aicampsql;
窗口函数
窗口函数也称为OLAP函数。OLAP 是OnLine AnalyticalProcessing 的简称,意思是对数据库数据进行实时分析处理。
为了便于理解,称之为窗口函数。常规的SELECT语句都是对整张表进行查询,而窗口函数可以让我们有选择的去某一部分数据进行汇总、计算和排序。
窗口函数的通用形式:
<窗口函数> OVER ([PARTITION BY <列名>]
ORDER BY <排序用列名>)
[]中的内容可以省略。
窗口函数最关键的是搞明白关键字PARTITON BY 和ORDER BY *****的作用。
PARTITON BY是用来分组,即选择要看哪个窗口,类似于GROUP BY 子句的分组功能,但是PARTITION BY 子句并不具备GROUP BY 子句的汇总功能,并不会改变原始表中记录的行数。
ORDER BY是用来排序,即决定窗口内,是按那种规则(字段)来排序的。
大致来说,窗口函数可以分为两类。
一是 将SUM、MAX、MIN等聚合函数用在窗口函数中
二是 RANK、DENSE_RANK等排序用的专用窗口函数
作者:初美ChuM
游戏编程,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
边栏推荐
- 拓維信息使用 Rainbond 的雲原生落地實踐
- [community star selection] the 23rd issue of the July revision plan | bit by bit creation, converging into a tower! Huawei freebuses 4E and other cool gifts
- torch stack() meshgrid()
- How to use the low code platform of the Internet of things for service management?
- Courage to be hated: Adler's philosophy class: the father of self inspiration
- Lenovo Yoga 27 2022, full upgrade of super configuration
- 正则表达式(正则匹配)
- Develop those things: how to add text watermarks to videos?
- 商业智能BI与业务管理决策思维之四:业务成本分析
- Brief introduction of Feature Engineering in machine learning
猜你喜欢

全栈代码测试覆盖率及用例发现系统的建设和实践

4个技巧告诉你,如何使用SMS促进业务销售?

一点比较有意思的模块

一套十万级TPS的IM综合消息系统的架构实践与思考

熵-条件熵-联合熵-互信息-交叉熵

Lenovo Yoga 27 2022, full upgrade of super configuration

Detailed single case mode

sqlserver SQL Server Management Studio和Transact-SQL创建账户、创建访问指定数据库的只读用户

年复一年,为什么打破数据孤岛还是企业发展的首要任务

Business Intelligence BI and business management decision-making thinking 4: business cost analysis
随机推荐
How does rust implement dependency injection?
RFFE中MIPI协议
Browser window switch activation event visibilitychange
JS string interception method summary
Evolution of screen display technology
Go Redis连接池
年复一年,为什么打破数据孤岛还是企业发展的首要任务
Courage to be hated: Adler's philosophy class: the father of self inspiration
Ditto设置全局仅粘贴文本快捷键
20220528【聊聊假芯片】贪便宜往往吃大亏,盘点下那些假的内存卡和固态硬盘
Temperature measuring instrument based on STM32 single chip microcomputer
「经验」爬虫在工作中的实战应用『实现篇』
德国AgBB VoC有害物质测试
Word -- a solution for word to encounter errors when trying to open a file
传统微服务框架如何无缝过渡到服务网格 ASM
MySQL transaction concurrency and mvcc mechanism
【DesignMode】单例模式(singleton pattern)
Ansi/ul 94 class 5-V vertical combustion test
教你Selenium 测试用例编写
Personally test the size of flutter after packaging APK, quite satisfied