Tasting Score Spread
Problem
Table: `entry`
| Column Name | Type |
|---|---|
| entry_id | int |
| roaster | varchar(40) |
| aroma | int |
| body | int |
| finish | int |
`entry_id` is the primary key. Each row is a coffee entered in a cupping contest, rated by judges on three attributes: `aroma`, `body`, and `finish`.
Each entry's total is the sum of its three attribute ratings. Return a single value, `score_spread`, equal to the difference between the highest total score and the lowest total score across all entries.
Tables
Example rows — the live problem includes the full dataset.
| entry_id | roaster | aroma | body | finish |
|---|---|---|---|---|
| 1 | Highland | 8 | 7 | 9 |
| 2 | Riverbend | 6 | 6 | 5 |
| 3 | Coastline | 9 | 9 | 8 |
Expected output
Your answer should return 1 row with the columns score_spread.
Starter code (SQL)
SELECT *
FROM entry;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