Poorly Received Recipes
Problem
Table: `recipes`
| Column Name | Type |
|---|---|
| recipe_id | int |
| upvotes | int |
| downvotes | int |
`recipe_id` is the primary key. Each row gives how many upvotes and downvotes a recipe received. Every recipe has at least one vote.
A recipe is poorly received when its upvote share, `upvotes / (upvotes + downvotes)`, is strictly below `0.6`. Return the `recipe_id` of every poorly received recipe, ordered by `recipe_id` ascending.
Tables
Example rows — the live problem includes the full dataset.
| recipe_id | upvotes | downvotes |
|---|---|---|
| 1 | 9 | 1 |
| 2 | 5 | 5 |
| 3 | 6 | 4 |
Expected output
Your answer should return 2 rows with the columns recipe_id.
Starter code (SQL)
SELECT *
FROM recipes;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