Top Bakery Showdown
Problem
Two bakeries are competing: each has a table of pastry ratings. `sunrise_bakery` and `harbor_bakery` both have rows of `(review_id, stars)` where `stars` is 1 to 5.
The winner is the bakery with MORE five-star reviews (stars = 5). Report the single column `champion`:
- 'Sunrise Bakery' if Sunrise has strictly more five-star reviews,
- 'Harbor Bakery' if Harbor has strictly more,
- 'Tie' if they have the same count.
Tables
Example rows — the live problem includes the full dataset.
| review_id | stars |
|---|---|
| 1 | 5 |
| 2 | 5 |
| 3 | 4 |
| review_id | stars |
|---|---|
| 1 | 5 |
| 2 | 3 |
| 3 | 5 |
Expected output
Your answer should return 1 row with the columns champion.
Starter code (SQL)
SELECT *
FROM sunrise_bakery;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