当前位置:网站首页>力扣(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
边栏推荐
- [Electronic Experiment 2] simple electronic doorbell
- Chapter IV memory management exercise
- Huawei's level 22 experts have worked hard for ten years to complete the advanced practical document of cloud native service grid. 6
- Cs5463 code module analysis (including download link)
- [chapter 71 of the flutter problem series] mutual conversion between uint8list and image in flutter
- [数学建模]Matlab非线性规划之fmincon()函数
- 【Flutter 問題系列第 71 篇】Flutter 中 Uint8List 和 Image 之間的相互轉換
- Count the number of arrays with pointers
- 【狀態機設計】Moore、Mealy狀態機、三段式、二段式、一段式狀態機書寫規範
- frameworks/base/core/res/res/values/symbols.xml:3915: error: no definition for declared symbol解决办法
猜你喜欢

CIN at QT (the clearest tutorial in the whole network)

stm32F407-------LCD

第四章 存储器管理练习
![[API packet capturing in selenium automation] installation and configuration of browsermobproxy](/img/67/3e15b2191ee23a8c4453aad007651d.png)
[API packet capturing in selenium automation] installation and configuration of browsermobproxy

What are the virtual machine software? What are their respective roles?

再次上榜!知道创宇入选2022中国网安产业竞争力50强

The secondary market is full of bad news. How should the market go next? One article will show you the general trend

ctfshow XSS

Association line exploration, how to connect the two nodes of the flow chart
![[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
随机推荐
Form verification problem - El select (solution to automatically trigger verification on initialization page)
Yyds dry inventory solution sword finger offer: maximum sum of continuous subarrays (II)
PHP uses endroid/qrcode QR code to generate, and Gd library generates sharing posters
华为22级专家十年心血终成云原生服务网格进阶实战文档,是真的6
Chapter II Classic synchronous exercises
[state machine design] Moore, Mealy state machine, three-stage, two-stage and one-stage state machine writing specification
ctfshow XSS
YuMinHong set up two funds funded by his hometown
Mysql-5.7.30-winx64 installation free download and installation tutorial
Serious internal entanglement in the we media industry: where should the enterprise we media go
[数学建模]Matlab非线性规划之fmincon()函数
What pitfalls should be avoided in the job interview for the operation post in 2022?
stm32F407-------外部中断
urllib.parse 解析url连接中的参数
When dialogfragment's onstop is completely invisible, call disass to exit the interface and report an error. Solution
Design e-commerce seckill system
Scrapy使用xlwt实现将数据以Excel格式导出的Exporter
关联线探究,如何连接流程图的两个节点
[mathematical modeling] fmincon() function of MATLAB nonlinear programming
[chapter 71 of the flutter problem series] mutual conversion between uint8list and image in flutter