当前位置:网站首页>力扣(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
边栏推荐
- Save data in Excel: use openpyxl to create multiple tables and set excel row limit
- 从SQL注入绕过最新安全狗WAF中学习fuzz
- C language - word analysis
- With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"
- See fengzhixia | FENGZikai, the originator of Guoman, for exclusive sale of Digital Collections
- TDD and automated testing
- 第二章 经典同步练习作业
- 【Flutter 問題系列第 71 篇】Flutter 中 Uint8List 和 Image 之間的相互轉換
- CIN at QT (the clearest tutorial in the whole network)
- What are the virtual machine software? What are their respective roles?
猜你喜欢

Matlab learning notes (6) upsample function and downsample function of MATLAB

ctfshow XSS
![[conception de la machine d'état] Moore, Mealy State Machine, Three - stage, Two - stage, one - stage State Machine Writing Specification](/img/48/e29f34aff7cc437bfb574591d54e3d.png)
[conception de la machine d'état] Moore, Mealy State Machine, Three - stage, Two - stage, one - stage State Machine Writing Specification

【软件分析】软件分析、设计与建模迭代式详解

ERROR 1067 (42000): Invalid default value for ‘end_ time‘ Mysql

Don't ask me how to do UI automation test again

第二章 经典同步练习作业

第五章 虚拟存储器 练习

Online yaml to JSON tool

note
随机推荐
stm32F407-------RTC实时时钟
stm32F407-------电容触摸按键
[state machine design] Moore, Mealy state machine, three-stage, two-stage and one-stage state machine writing specification
What is the lifecycle of automated testing?
[数学建模]Matlab非线性规划之fmincon()函数
Lock4j -- distributed locking Middleware -- use / instance
Three communication skills in software testing
stm32F407-------IO引脚复用映射
Scrapy uses xlwt to implement the exporter that exports data in Excel format
VSCode里使用条件断点(基于GDB)
YuMinHong set up two funds funded by his hometown
Oil monkey script learning
Advice to friends
Chapter IV memory management exercise
Chapter III processor scheduling exercise
Mobile heterogeneous computing technology - GPU OpenCL programming (basic)
TDD and automated testing
笔记
Rongyun communication solution solves the pain points of enterprise communication
解决ConfigParser解析中文问题