当前位置:网站首页>力扣(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
边栏推荐
- Yyds dry inventory solution sword finger offer: maximum sum of continuous subarrays (II)
- 百度知道爬虫,根据问题id,线索id,评论id获取评论下面的对话
- C语言-单词分析解析
- What are the virtual machine software? What are their respective roles?
- 网上注册股票开户很困难么?在线开户是安全么?
- Chapter V virtual memory exercise
- Count the number of arrays with pointers
- 从SQL注入绕过最新安全狗WAF中学习fuzz
- Mysql-5.7.30-winx64 installation free download and installation tutorial
- 10. Standard i/o redirection and pipeline
猜你喜欢

Chapter III processor scheduling exercise

stm32F407-------外部中断

stm32F407-------通用定时器

stm32F407-------NVIC中断优先级管理

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

With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"
![[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

Interviewer: what is the internal implementation of strings in redis?

PHP 使用endroid/qrcode 二维码生成, GD库生成分享海报

What are some tips to improve your interview success rate?
随机推荐
ERROR 1067 (42000): Invalid default value for ‘end_ time‘ Mysql
[Chapter 2 of word tutorial series] how to set the table on each page to have a header in word
C interview questions_ 20220627 record
[word Tutorial Series Part 1] how to remove arrows in word tables
Chapter II Classic synchronous exercises
Chapter III processor scheduling exercise
The secondary market is full of bad news. How should the market go next? One article will show you the general trend
Design e-commerce seckill system
他原来是这么刷题的!
没找到实习,他总结了这些
CMake教程(一)
表单校验问题——el-select(初始化页面自动触发校验解决办法)
ctfshow XSS
Have you ever met a fake interview in a job interview? How to avoid?
Learning fuzzy from SQL injection to bypass the latest safe dog WAF
Counting sorting and stability of sorting
图片64base转码与解码
Chapter IV memory management exercise
笔记
CIN at QT (the clearest tutorial in the whole network)