https://www.hackerrank.com/challenges/interviews/problem?isFullScreen=true
Interviews | HackerRank
find total number of view, total number of unique views, total number of submissions and total number of accepted submissions.
www.hackerrank.com
Samantha는 코딩 챌린지와 컨테스트를 통해 여러 대학의 많은 후보자를 인터뷰합니다.
contest_id, hacker_id, name과 각 컨테스트 별 total_submissions, total_accepted_submissions, total_views, total_unique_views의 합계를 출력합니다.
4개의 합계가 모두 0이면 해당 컨테스트를 결과에서 제외합니다.
참고: 특정 컨테스트는 한 개 이상의 대학에서 후보자를 선별하는데 활용될 수 있지만, 각 대학은 하나의 컨테스트만 개최합니다.
SELECT ct.contest_id
,ct.hacker_id
, ct.name
, sum(ss.total_submissions) total_submissions
, sum(ss.total_accepted_submissions) total_accepted_submissions
, sum(vs.total_views) total_views
, sum(vs.total_unique_views) total_unique_views
FROM Contests ct JOIN Colleges cl
ON ct.contest_id = cl.contest_id
JOIN Challenges cg
ON cl.college_id = cg.college_id
JOIN View_Stats vs
ON cg.challenge_id = vs.challenge_id
JOIN Submission_Stats ss
ON cg.challenge_id = ss.challenge_id
GROUP BY ct.contest_id, ct.hacker_id, ct.name;
잘못된 코드! 첫번째 시도!!
HackerRank SQL - Interviews
Samantha interviews many candidates from different colleges using coding challenges and contests. Write a query to print the contest_id, hacker_id, name, and the sums of total_submissions, total_accepted_submissions, total_views, and total_unique_views for
jinooh.tistory.com
정리가 잘 되어있는 글 발견
다시 시도할 예정!
'𝙎𝙌𝙇' 카테고리의 다른 글
문자열 합치기 CONCAT('A', 'B') (0) | 2024.03.27 |
---|---|
[HackerRank] Weather Observation Station 5 (0) | 2023.08.09 |
[HackerRank] Symmetric Pairs (0) | 2023.08.02 |
[HackerRank] Placements (0) | 2023.07.27 |
[HackerRank] SQL Project Planning (0) | 2023.07.26 |