* Problem
Write a solution that will, for each user, return the number of followers. Return the result table ordered by user_id in ascending order.
* Explanation
The followers of 0 are {1}
The followers of 1 are {0}
The followers of 2 are {0,1}
* Solution (Success)
# Write your MySQL query statement below
select user_id, count(follower_id) followers_count
from Followers
group by user_id
order by user_id
'Study - Problems(IT) > LeetCode - SQL' 카테고리의 다른 글
1045.Customers Who Bought All Products (0) | 2024.11.26 |
---|---|
619.Biggest Single Number (0) | 2024.11.25 |
596. Classes More Than 5 Students (2) | 2024.11.23 |
1070. Product Sales Analysis 3 (0) | 2024.11.22 |
1141.User Activity for the Past 30 Days I (1) | 2024.11.21 |