Loading problem...
A community learning platform hosts many coding contests and tracks which users sign up for each event.
Table: users
Table: register
Task: For every contest_id present in register, compute what share of all platform users registered for that contest.
Metric:
Output requirements:
Supported submission environments:
users:
| user_id | user_name |
|---------|-----------|
| 6 | Alice |
| 2 | Bob |
| 7 | Alex |
register:
| contest_id | user_id |
|------------|---------|
| 215 | 6 |
| 209 | 2 |
| 208 | 2 |
| 210 | 6 |
| 208 | 6 |
| 209 | 7 |
| 209 | 6 |
| 215 | 7 |
| 208 | 7 |
| 210 | 2 |
| 207 | 2 |
| 210 | 7 |[
{"contest_id":208,"percentage":100.0},
{"contest_id":209,"percentage":100.0},
{"contest_id":210,"percentage":100.0},
{"contest_id":215,"percentage":66.67},
{"contest_id":207,"percentage":33.33}
]Contests 208, 209, and 210 have all 3 users, so each is 100.00. Contest 215 has 2 of 3 users (66.67), and contest 207 has 1 of 3 users (33.33).
users:
| user_id | user_name |
|---------|-----------|
| 1 | Maya |
| 2 | Noah |
| 3 | Pia |
| 4 | Rohan |
register:
| contest_id | user_id |
|------------|---------|
| 501 | 1 |
| 501 | 2 |
| 501 | 3 |
| 502 | 2 |
| 502 | 4 |
| 503 | 1 |
| 503 | 3 |[
{"contest_id":501,"percentage":75.0},
{"contest_id":502,"percentage":50.0},
{"contest_id":503,"percentage":50.0}
]Contest 501 has 3 of 4 users (75.00). Contests 502 and 503 each have 2 of 4 users (50.00), so tie-breaking uses contest_id ascending.
users:
| user_id | user_name |
|---------|-----------|
| 10 | Elena |
| 11 | Faris |
| 12 | Gia |
register:
[][]No contest appears in register, so there are no output rows.
Constraints