当前位置:网站首页>力扣(LeetCode)178. 分数排名(2022.06.27)
力扣(LeetCode)178. 分数排名(2022.06.27)
2022-06-28 23:31:00 【ChaoYue_miku】
表: Scores
±------------±--------+
| Column Name | Type |
±------------±--------+
| id | int |
| score | decimal |
±------------±--------+
Id是该表的主键。
该表的每一行都包含了一场比赛的分数。Score是一个有两位小数点的浮点值。
编写 SQL 查询对分数进行排序。排名按以下规则计算:
分数应按从高到低排列。
如果两个分数相等,那么两个分数的排名应该相同。
在排名相同的分数后,排名数应该是下一个连续的整数。换句话说,排名之间不应该有空缺的数字。
按 score 降序返回结果表。
查询结果格式如下所示。
示例 1:
输入:
Scores 表:
±—±------+
| id | score |
±—±------+
| 1 | 3.50 |
| 2 | 3.65 |
| 3 | 4.00 |
| 4 | 3.85 |
| 5 | 4.00 |
| 6 | 3.65 |
±—±------+
输出:
±------±-----+
| score | rank |
±------±-----+
| 4.00 | 1 |
| 4.00 | 1 |
| 3.85 | 2 |
| 3.65 | 3 |
| 3.65 | 3 |
| 3.50 | 4 |
±------±-----+
来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/rank-scores
边栏推荐
猜你喜欢

With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"

MATLAB 学习笔记(6)MATLAB 的 upsample 函数和 downsample 函数

See fengzhixia | FENGZikai, the originator of Guoman, for exclusive sale of Digital Collections
![[stm32 Hal library] serial port communication](/img/2c/23a2ecf75141b8f38ab99ac6b2eaef.png)
[stm32 Hal library] serial port communication
![[Chapter 2 of word tutorial series] how to set the table on each page to have a header in word](/img/1a/8416d2c48bf1ddcc45e0c5d9acf242.png)
[Chapter 2 of word tutorial series] how to set the table on each page to have a header in word

Mobile heterogeneous computing technology - GPU OpenCL programming (basic)

这样学习二叉树

ROS2中的行为树 BehaviorTree

Mysql-5.7.30-winx64 installation free download and installation tutorial

note
随机推荐
Learn binary tree like this
Three communication skills in software testing
lock4j--分布式锁中间件--使用/实例
10. Standard i/o redirection and pipeline
urllib.parse 解析url连接中的参数
With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"
LINQ linked table query
C interview questions_ 20220627 record
I can't sleep
Don't ask me how to do UI automation test again
TDD和自动化测试
pymysql. Error get error code and specific error information
Chapter IV memory management exercise
Analysis of CSRF Cross Site Request Forgery vulnerability
scrapy保存数据到excel:利用openpyxl创建多张表,设置Excel行数限制
Scrapy uses xlwt to implement the exporter that exports data in Excel format
[mathematical modeling] fmincon() function of MATLAB nonlinear programming
Mobile heterogeneous computing technology - GPU OpenCL programming (basic)
IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021
Keil project, RTT cannot print after too many programs are written