- 1、本文档共9页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
PostgreSQL的window函数整理.doc
PostgreSQL的window函数整理A window function performs a calculation across a set of table rows that are somehow related to the current row. This is comparable to the type of calculation that can be done with an aggregate function. But unlike regular aggregate functions, use of a window function does not cause rows to become grouped into a single output row — the rows retain their separate identities. Behind the scenes, the window function is able to access more than just the current row of the query result.?? ? Window Functions in SQL is an OLAP functionality that provides ranking, cumulative computation, and partitioning aggregation. Many commercial RDMBS such like Oracle, MS SQL Server and DB2 have implemented part of this specification, while open source RDMBS including PostgreSQL, MySQL and Firebird doesnt yet. To implement this functionality on PostgreSQL not only helps many users move from those RDBMS to PostgreSQL but encourages OLAP applications such as BI (Business Inteligence) to analyze large data set. This specification is defined first in SQL:2003, and improved in SQL:2008?简言之,聚合函数返回的各个分组的结果,窗口函数则为每一行返回结果,示例如下:?1.建示例表,初始化数据
DROP TABLE IF EXISTS empsalary;
CREATE TABLE empsalary(
depname varchar,
empno bigint,
salary int,
enroll_date date
);
INSERT INTO empsalary VALUES(develop,10, 5200, 2007/08/01);
INSERT INTO empsalary VALUES(sales, 1, 5000, 2006/10/01);
INSERT INTO empsalary VALUES(personnel, 5, 3500, 2007/12/10);
INSERT INTO empsalary VALUES(sales, 4, 4800, 2007/08/08);
INSERT INTO empsalary VALUES(sales, 6, 5500, 2007/01/02);
INSERT INTO empsalary VALUES(personnel, 2, 3900, 2006/12/23);
INSERT INTO empsalary VALUES(develop, 7, 4200, 2008/01/01);
INSERT INTO empsalary VALUES(develop, 9, 4500, 2008/01/01);
INSERT INTO empsalary VALUES(sales, 3, 4800, 2007/08/01);
INSERT INTO empsalary VALUES(develop, 8, 6000, 2006/10/01);
INSERT INTO empsalary VALUES(develop, 11, 5200, 2007/08/15);
postgres=# select * from empsalary ;
depname | empno | salary
您可能关注的文档
最近下载
- 攀枝花市鸿硕工贸有限公司地块土壤污染状况详细调查与风险评估报告.pdf
- 第3课+古代西亚、非洲文化+高二历史统编版(2019)选择性必修3.pptx VIP
- 高危孕产妇的识别与救治.ppt
- JTGT J23-2008 公路桥梁加固施工技术规范正式版.pdf
- 果汁-总酸量可滴定酸的测定-滴定法.DOC
- 作业10:工学一体化课程《windows服务器基础配置与局域网组建》任务1学习任务信息页.docx VIP
- 精品解析:2024年山东省济南市高新区中考一模英语试题(解析版).docx VIP
- 2017-2018新零售年度回顾与展望:产业活跃市场平淡,变革浪潮已至.研究报告.pdf
- 2024年贵州省中考英语试题(含答案解析) .pdf
- 2025年浙教版八年级下册数学第6章综合检测试卷及答案.docx VIP
文档评论(0)