AnalystPath

Recommendable Trails

SQLEasyJunior level~15 min

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
trail_idtrail_namesummaryscore
1Cedar Ridgescenic ridge8.4
2Fog Hollowmuddy loop7.1
3Iron Passclosed5.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

Related SQL questions