Recommendable Trails
Problem
Table: `trail`
| Column Name | Type |
|---|---|
| trail_id | int |
| trail_name | varchar |
| summary | varchar |
| score | float |
`trail_id` is the primary key. Each row describes a hiking trail, a short summary of its character, and a 0-10 popularity `score`.
Return every trail whose `trail_id` is odd **and** whose `summary` is not the word `'closed'`. Sort the result by `score` in descending order. Keep all four columns.
Tables
Example rows — the live problem includes the full dataset.
| trail_id | trail_name | summary | score |
|---|---|---|---|
| 1 | Cedar Ridge | scenic ridge | 8.4 |
| 2 | Fog Hollow | muddy loop | 7.1 |
| 3 | Iron Pass | closed | 5.9 |
Expected output
Your answer should return 2 rows with the columns trail_id, trail_name, summary, score.
Starter code (SQL)
SELECT *
FROM trail;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