AnalystPath

Member Count per Club

SQLMediumMid level~15 min

Problem

Table: `Member`

```text
+-----------+---------+
| Column | Type |
+-----------+---------+
| member_id | int |
| member_name| varchar|
| year_level| varchar |
| club_id | int |
+-----------+---------+
member_id is the primary key.
```

Table: `Club`

```text
+---------+---------+
| Column | Type |
+---------+---------+
| club_id | int |
| club_name| varchar|
+---------+---------+
club_id is the primary key.
```

For **every** club in the Club table (including clubs that currently have no members), report the `club_name` and the number of members who belong to it as `member_count`. Sort by `member_count` descending, then by `club_name` ascending.

Tables

Example rows — the live problem includes the full dataset.

Member
member_idmember_nameyear_levelclub_id
10AyaY11
11BenY21
12ColeY12
Club
club_idclub_name
1Chess
2Robotics
3Debate

Expected output

Your answer should return 3 rows with the columns club_name, member_count.

Starter code (SQL)

SELECT *
FROM Member;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions