문제
입력 코드
WITH base AS (SELECT requester_id AS id FROM RequestAccepted
UNION ALL
SELECT accepter_id AS id FROM RequestAccepted)
SELECT id, COUNT(*) AS num
FROM base
GROUP BY 1
ORDER BY 2 DESC
LIMIT 1
코드 설명
#UNION #UNION ALL #SELECT #COUNT #GROUP BY #ORDER BY #DESC #LIMIT
문제 출처
'SQL' 카테고리의 다른 글
#117. [LeetCode / MySQL] 185. Department Top Three Salaries (0) | 2024.06.20 |
---|---|
#116. [LeetCode / MySQL] 585. Investments in 2016 (0) | 2024.06.19 |
#114. [LeetCode / MySQL] 1321. Restaurant Growth (0) | 2024.06.18 |
#113. [LeetCode / MySQL] 1341. Movie Rating (0) | 2024.06.18 |
#112. [LeetCode / MySQL] 626. Exchange Seats (0) | 2024.06.17 |