Oracle keep函数

  之前看到keep函数,一直不明白函数含义,找到一个英文版解释,感觉很清晰,特翻译下。
MIN ( sal ) KEEP ( DENSE_RANK FIRST ORDER BY sal ) OVER ( PARTITION BY deptno )

  The statement can be considered in (roughly) right-to-left order:

这个语句可以被大致认为是从右到左排序

  • OVER (PARTITION BY deptno) means partition the rows into distinct groups of deptno; then
  • OVER (PARTITION BY deptno)意味着按照deptno分组
  • ORDER BY sal means, for each partition, order the rows by sal (implicitly using ASCending order); then
  • ORDER BY sal means意味着对于每个组,按照sal排序(默认?升序)
  • KEEP (DENSE_RANK FIRST means give an "olympic" rank to the ordered rows for each partition (rows with identical values for the ordering columns will be given the same rank) and discard all rows which are not ranked first; and finally
  • KEEP (DENSE_RANK FIRST 意味着对每个组用“奥林匹克”方式排序(具有相同值的行具有相同的排名),并舍弃所有不是排名第一的行。
  • MIN(sal) for the remaining rows of each partition, return the minimum salary.
  • MIN(sal)对于每个组余下的行,保留其最小值



  原帖地址:http://stackoverflow.com/questions/20145952/partition-by-with-and-without-keep-in-oracle

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值