Grokking SQL for Tech Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
18. Find Followers Count
On this page

Problem

Table: Followers

+-------------+------+
| Column Name | Type |
+-------------+------+
| user_id     | int  |
| follower_id | int  |
+-------------+------+
(user_id, follower_id) is the primary key (combination of columns with unique values) for this table.
This table contains the IDs of a user and a follower in a social media app where the follower follows the user.

Problem Definition

Write a solution that will, for each user, return the number of followers.

Return the result table ordered by user_id in ascending order.

Example

Output

Try It Yourself

.....

.....

.....

Like the course? Get enrolled and start learning!

On this page