Times Each Chef Appears on the Menu
Problem
Table: `menu_board`
| Column Name | Type |
|---|---|
| dish_id | int |
| dish_name | varchar |
| chef | varchar |
`dish_id` is the primary key. Each row is one dish currently listed on the tasting menu, attributed to the chef who created it.
Count how many dishes each chef has on the board. Output the chef's name and that count aliased as `appearances`. Order by `appearances` descending; break ties by `chef` ascending.
Tables
Example rows — the live problem includes the full dataset.
| dish_id | dish_name | chef |
|---|---|---|
| 101 | Charred Leek Tart | Rosa Linde |
| 102 | Saffron Gnocchi | Marco Pell |
| 103 | Smoked Plum Bao | Rosa Linde |
Expected output
Your answer should return 3 rows with the columns chef, appearances.
Starter code (SQL)
SELECT *
FROM menu_board;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