AnalystPath

Top Bakery Showdown

SQLEasyJunior level~15 min

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.

sunrise_bakery
review_idstars
15
25
34
harbor_bakery
review_idstars
15
23
35

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

Related SQL questions