Gluten-Free Vegan Menu Items
Problem
A cafe stores its menu in a single table, one row per dish.
```
MenuItem
+-------------+---------+
| Column | Type |
+-------------+---------+
| dish_id | int |
| gluten_free | varchar |
| vegan | varchar |
+-------------+---------+
dish_id is the primary key.
gluten_free is one of ('T','F'): 'T' means the dish is gluten free, 'F' means it is not.
vegan is one of ('T','F'): 'T' means the dish is vegan, 'F' means it is not.
```
Write a query to find the `dish_id` of every dish that is **both** gluten free **and** vegan.
Return the result in any order.
Tables
Example rows — the live problem includes the full dataset.
| dish_id | gluten_free | vegan |
|---|---|---|
| 10 | T | F |
| 11 | T | T |
| 12 | F | T |
Expected output
Your answer should return 2 rows with the columns dish_id.
Starter code (SQL)
SELECT *
FROM MenuItem;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