当前位置:网站首页>力扣(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
边栏推荐
- LINQ linked table query
- note
- 2022 PMP project management examination agile knowledge points (4)
- ERROR 1067 (42000): Invalid default value for ‘end_time‘ Mysql
- PHP uses endroid/qrcode QR code to generate, and Gd library generates sharing posters
- 解决ConfigParser解析中文问题
- Three communication skills in software testing
- Behaviortree in ros2
- Solve the problem of Chinese parsing by configparser
- [conception de la machine d'état] Moore, Mealy State Machine, Three - stage, Two - stage, one - stage State Machine Writing Specification
猜你喜欢

Lock4j -- distributed locking Middleware -- use / instance

What are some tips to improve your interview success rate?

笔记

ERROR 1067 (42000): Invalid default value for ‘end_ time‘ Mysql
![[word Tutorial Series Part 1] how to remove arrows in word tables](/img/c7/dc57002b0e9d433c4dfac15d53713d.png)
[word Tutorial Series Part 1] how to remove arrows in word tables

MATLAB 学习笔记(6)MATLAB 的 upsample 函数和 downsample 函数
![[opencv] - linear filtering: box filtering, mean filtering, Gaussian filtering](/img/1d/3a46517cbfa90005a15d7858d81ca9.png)
[opencv] - linear filtering: box filtering, mean filtering, Gaussian filtering

再次上榜!知道创宇入选2022中国网安产业竞争力50强
![[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

Be on the list again! Know that Chuangyu was selected as one of the top 50 competitive enterprises in China's network security industry in 2022
随机推荐
Non scientific class! The road of self-study!
Puma joins hands with 10ktf shop to launch its Web3 cooperation project with the largest scale so far
解决ConfigParser解析中文问题
Have you ever met a fake interview in a job interview? How to avoid?
Keil project, RTT cannot print after too many programs are written
Use conditional breakpoints in vscode (based on GDB)
window10 phpstudy 安装redis扩展
PHP uses curl to download Excel files after logging in to the website
他原来是这么刷题的!
ROS2中的行为树 BehaviorTree
[数学建模]Matlab非线性规划之fmincon()函数
Baidu knows the crawler, and obtains the dialogue below the comment according to the question Id, clue ID and comment ID
笔记
[SSM] an error is reported that the user name of the access denied for user 'WYF' @ 'localhost' (using password: yes) data becomes the user name of the computer
I can't sleep
Picture 64base transcoding and decoding
Windows10 phpstudy installing redis extension
10. Standard i/o redirection and pipeline
[flutter issues Series title 71] Mutual Conversion between uint8list and Image in flutter
CMake教程(一)