Most-Voted Book of the Month
Problem
Table: `Book`
```text
+--------+---------+
| Column | Type |
+--------+---------+
| book_id| int |
| title | varchar |
+--------+---------+
book_id is the primary key.
```
Table: `Ballot`
```text
+----------+--------+
| Column | Type |
+----------+--------+
| ballot_id| int |
| book_id | int |
+----------+--------+
ballot_id is the primary key; each row is one member's vote for a book.
```
Report the `title` of the book that received the most votes. Exactly one book wins.
Tables
Example rows — the live problem includes the full dataset.
| book_id | title |
|---|---|
| 1 | Tidewrack |
| 2 | Glasswing |
| 3 | Saltmarch |
| ballot_id | book_id |
|---|---|
| 10 | 2 |
| 11 | 2 |
| 12 | 1 |
Expected output
Your answer should return 1 row with the columns title.
Starter code (SQL)
SELECT *
FROM Book;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