문제

Julia just finished conducting a coding contest, and she needs your help assembling the leaderboard! Write a query to print the respective hacker_id and name of hackers who achieved full scores for more than one challenge. Order your output in descending order by the total number of challenges in which the hacker earned a full score. If more than one hacker received full scores in same number of challenges, then sort them by ascending hacker_id.

 

1. 2개 이상의 챌린지 성공 및 만점 획득한 hacker를 찾아야 한다.

2. Difficulty테이블에서 difficulty_level에 따른 score와 hacker들이 획득한 score, difficulty_level이 일치하는지 확인해야 한다.

 

총 4개의 테이블이 있으며, 이들을 모두 inner_join 해준 후 차례대로 조건을 걸어주면 된다.

 

 

실행 코드

HAVING COUNT(H.HACKER_ID) > 1 조건을 추가해서 2개 이상의 챌린지를 한 hacker를 찾아주었다.

테이블이 4개라서 join절을 작성한 구문이 조금 복잡하다고 느껴지는데, 코드를 뜯어보면 전혀.. 그렇지 않다!

 

+ Recent posts