zoukankan      html  css  js  c++  java
  • 排名函数row_number(),rank(),

    表结构如下

    create table IF NOT EXISTS SS
    (
    Id int,
    Score double
    )
    row format delimited fields terminated by ',';

    数据如下

    Id     Score 

     1      3.50 
     2      3.65 
     3      4.00 
     4      3.85 
     5      4.00 
     6      3.65 

    select Score,row_numer() over(order by Score desc) from SS;

    Score   rank

    4.00       1

    4.00       2

    3.85       3

    3.65       4

    3.65       5

    3.50       6

    select  Score,rank() over(order by Score desc) from SS;

    4.00       1

    4.00       1

    3.85       3

    3.65       4

    3.65       4

    3.50       6

    select  Score,dense_rank() over(order by Score desc) from SS;

    4.00       1

    4.00       1

    3.85       2

    3.65       3

    3.65       3

    3.50       4

  • 相关阅读:
    字体图标的制作
    vs code 本地调试配置
    瀑布流
    web组件化开发第一天
    超时调用和间歇调用
    递归 闭包
    继承
    面向对象的程序设计
    function类型
    Date类型
  • 原文地址:https://www.cnblogs.com/simpledu/p/15520054.html
Copyright © 2011-2022 走看看