728x90
https://www.hackerrank.com/challenges/challenges/problem
Challenges | HackerRank
Print the total number of challenges created by hackers.
www.hackerrank.com
with t1 as(
select hacker_id, count(distinct challenge_id) as c_cnt
from challenges
group by hacker_id
)
select t1.hacker_id, hackers.name, c_cnt
from t1
join hackers on t1.hacker_id = hackers.hacker_id
where 1=1
and (t1.c_cnt = (select max(c_cnt) from t1)
or
t1.c_cnt not in (select c_cnt from t1
group by c_cnt having count(c_cnt)>=2)
)
order by c_cnt desc, hacker_id asc
728x90
'데이터 분석 > [SQL] 기초' 카테고리의 다른 글
[hackerrank] MySQL - The Report (0) | 2025.03.20 |
---|---|
[hackerrank] MySQL - Contest Leaderboard (0) | 2025.03.20 |
[프로그래머스] SQL 연습 String, Date - 자동차 대여 기록별 대여 금액 구하기 (0) | 2025.03.14 |
[프로그래머스] SQL 연습 GROUP BY - 대여 횟수가 많은 자동차들의 월별 대여 횟수 구하기 (0) | 2025.03.11 |
[프로그래머스] SQL 연습 SUM,MAX,MIN - 가격이 제일 비싼 식품의 정보 출력하기 (0) | 2025.03.11 |