[MSQL]ハッカーランキング(HackerRank)-ConTest LeaderBoard
https://www.hackerrank.com/challenges/contest-leaderboard/problem?isFullScreen=true
質問する
解析
ハッカーの総得点はすべての挑戦の最大得点の合計です.クエリーを作成して、降順スコアでソートされたハッカーのhacker id、名前、および合計スコアを出力します.複数のハッカーが同じ合計スコアを取得した場合、hacker id昇順に結果をソートします.合計0に分かれたすべてのハッカーをあなたの結果から除外します.
質問する
解析
ハッカーの総得点はすべての挑戦の最大得点の合計です.クエリーを作成して、降順スコアでソートされたハッカーのhacker id、名前、および合計スコアを出力します.複数のハッカーが同じ合計スコアを取得した場合、hacker id昇順に結果をソートします.合計0に分かれたすべてのハッカーをあなたの結果から除外します.
select
h.hacker_id
, h.name
, sum(score)
from
(
select
hacker_id
, challenge_id
, max(score) as score
from
submissions
group by
hacker_id
, challenge_id
) as t
join hackers as h on t.hacker_id = h.hacker_id
group by
h.hacker_id
, h.name
having
sum(score) > 0
order by
sum(score) desc
, h.hacker_id
Reference
この問題について([MSQL]ハッカーランキング(HackerRank)-ConTest LeaderBoard), 我々は、より多くの情報をここで見つけました https://velog.io/@develop_wan/MSSQL-해커랭크HackerRank-Contest-Leaderboardテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol