Gyms With Membership Growth in 2023
Problem
Table: `GymBranches`
```text
+-------------+------+
| Column Name | Type |
+-------------+------+
| branch_id | int |
| season | int |
| net_signups | int |
+-------------+------+
(branch_id, season) is the primary key for this table.
Each row records the net change in active members at a gym branch during a given season.
net_signups can be negative when more members cancelled than joined.
```
A fitness chain wants to know which branches actually grew their membership during the 2023 season.
Write a solution to report the `branch_id` of every branch whose net_signups in season 2023 was strictly greater than 0.
Return the result table in any order.
Tables
Example rows — the live problem includes the full dataset.
| branch_id | season | net_signups |
|---|---|---|
| 1 | 2022 | 50 |
| 1 | 2023 | 120 |
| 2 | 2023 | -30 |
Expected output
Your answer should return 2 rows with the columns branch_id.
Starter code (SQL)
SELECT *
FROM GymBranches;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