일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- ADsP
- 알고리즘
- python
- 누가 진정한 리더인가
- 후기
- EBS
- 당신이 몰랐던 진화론
- 빅데이터
- 데이터분석전문가
- 조지프 나이
- 공부정리
- Hacker Rank
- Progate
- Udemy
- K-MOOC
- Baekjoon
- Great Minds
- ADP
- CNN10
- 자료구조
- 백준
- MySQL
- 정치학
- 맛집
- Joseph Samuel Nye Jr.
- 위대한 수업
- 데이터분석전문가가이드
- 코테
- 미분적분학
- KMOOC
Archives
- Today
- Total
ㅇ
[Hacker Rank_MySQL]문제 풀이#Contest Leaderboard 본문
SQL > Basic Join > Contest Leaderboard
Contest Leaderboard | HackerRank
Generate the contest leaderboard.
www.hackerrank.com
The total score of a hacker is the sum of their maximum scores for all of the challenges. Write a query to print the hacker_id, name, and total score of the hackers ordered by the descending score. If more than one hacker achieved the same total score, then sort the result by ascending hacker_id. Exclude all hackers with a total score of 0 from your result.
빨간 글씨는 내가 문제를 풀 때 중요하다고 생각한 부분이다.
SELECT H.HACKER_ID, H.NAME, SUM(TS.MS)
FROM HACKERS H
JOIN (SELECT HACKER_ID, CHALLENGE_ID, MAX(SCORE) MS
FROM SUBMISSIONS
GROUP BY HACKER_ID, CHALLENGE_ID) TS
ON H.HACKER_ID = TS.HACKER_ID
GROUP BY H.HACKER_ID, H.NAME
HAVING SUM(TS.MS) != 0
ORDER BY SUM(TS.MS) DESC, H.HACKER_ID ASC
반응형
'IT > 코테문제' 카테고리의 다른 글
[Python] 문제 풀 때 요령_231012 (0) | 2023.10.15 |
---|---|
[Hacker Rank_Linux Shell]문제 풀이#Bash_1 (0) | 2022.03.02 |
[Hacker Rank_MySQL]문제 풀이#Symmetric Pairs (0) | 2022.03.01 |
[Hacker Rank_MySQL]문제 풀이#New Companies (0) | 2022.03.01 |
[Hacker Rank_MySQL]문제 풀이#Binary Tree Nodes (0) | 2022.03.01 |
Comments