AnalystPath

Chess Club Ladder Standings

SQLMediumMid level~15 min

Problem

Table: `Clubs`

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

Table: `Bouts`

```text
+-------------+------+
| Column | Type |
+-------------+------+
| bout_id | int |
| white_club | int |
| black_club | int |
| white_wins | int |
| black_wins | int |
+-------------+------+
bout_id is the primary key. Each row is a team match between two clubs: the
club playing White and the club playing Black, with the number of individual
boards each side won.
```

Score each club across all bouts using: **3 points** for winning a bout (more board wins than the opponent), **1 point** for a tie (equal board wins), and **0 points** for a loss. A club that played no bouts has 0 points.

Return `club_id`, `club_name`, `standing_points`, ordered by `standing_points` descending, then `club_id` ascending.

Tables

Example rows — the live problem includes the full dataset.

Clubs
club_idclub_name
10Knight Owls
20Rook Riders
30Bishop Brigade
Bouts
bout_idwhite_clubblack_clubwhite_winsblack_wins
1102030
2301022
3105051

Expected output

Your answer should return 5 rows with the columns club_id, club_name, standing_points.

Starter code (SQL)

SELECT *
FROM Clubs;

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