gpt4 book ai didi

mysql - 为什么我不能对 SQL 'rank scores' 使用 dense_rank?

转载 作者:行者123 更新时间:2023-11-30 21:25:19 26 4
gpt4 key购买 nike

我在 SQL 中使用 dense_rank 函数来解决 leetcode 的“排名分数”问题(https://leetcode.com/problems/rank-scores/description/):

select Score, dense_rank() over (order by Score) Rank
from Scores
order by Score desc

它总是给我以下错误:

Line 2: SyntaxError: near '(order by Score) Rank
from Scores
order by Score desc'

我想知道如何使这个答案正确?非常感谢!

此外,我意识到大多数人在不使用 DENSE_RANK 函数的情况下使用答案,这非常令人困惑,因为对我来说 DENSE_RANK 可能是解决问题的最直观方法。有人知道吗?再次感谢!

最佳答案

编辑后的答案

我的 SQL 不支持 dense_rank,但它支持其他窗口函数。查看this寻求帮助。

或者,您可以在另一个 SQL 服务器中运行代码

关于mysql - 为什么我不能对 SQL 'rank scores' 使用 dense_rank?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59383656/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com