SQL problem - Find Followers Count
Problem
Query
Note:
- (user_id, follower_id) is unique
- user
COUNTfunction to count the occurences of a singleuser_idCOUNTaggregation function often requires the field to aggregate by => done by usingGROUP BYclause
ORDER BYTO order the result by ascending order
SELECT user_id, COUNT(follower_id) AS followers_count
FROM Followers
GROUP BY user_id
ORDER BY user_id ASC
