코린이의 소소한 공부노트

[LeetCode/Easy] 1729. Find Followers Count 본문

코딩테스트 풀이/SQL

[LeetCode/Easy] 1729. Find Followers Count

무지맘 2023. 3. 29. 17:16

1. Input

1) Table: Followers (pk: (user_id, follower_id))

 

2. Output

1) 각 유저별로 팔로워 수를 출력

- user_id 오름차순으로 출력한다.

 

3. Example

 

4. Code

1) 첫 코드(2023/03/29)

select user_id, count(follower_id) as followers_count
from Followers
group by user_id
order by user_id;