602. Friend Requests II: Who Has the Most Friends

윤지현·2024년 9월 20일

SQL(Programmers)

목록 보기
117/184
  • 문제
  • 정답
SELECT id, COUNT(*) num
FROM (SELECT requester_id id FROM RequestAccepted 
UNION ALL
SELECT accepter_id FROM RequestAccepted) friends_count
GROUP BY 1
ORDER BY 2 DESC
LIMIT 1
  • 결과
profile
첫 시작

0개의 댓글