Find Followers Count

2pts
Twitter

Problem Statement

Data scientists at Twitter (X) need to identify the reach of different accounts. To do this, they require a simple tally of followers for every user on the platform.

Write an SQL query that will, for each user, return the number of followers.

Rules:

  • Each row in the table represents a unique relationship where follower_id follows user_id.
  • Return the result table containing user_id and followers_count.
  • Results must be sorted by user_id in ascending order.
Tests your understanding of
Basic SQL, Aggregation, COUNT and Grouping

Input Tables

followers
user_id(INTEGER)follower_id(INTEGER)
01
10
20
21

Expected Output

user_id(INTEGER)followers_count(INTEGER)
01
11
22

Tags

EasyBasic SQLAggregationCOUNTGrouping
5-10 min
68%

Hints