Not Boring Movies
Preview mode. Log in to edit, run, submit, and save progress.
Medium
Description
You have a Cinema table. Write a SQL query to report all movies with an odd-numbered id and a description that is NOT 'boring'. Return the result ordered by rating in descending order.
Database Schema
Cinema
| Column Name | Type | Description |
|---|---|---|
| id | INT | Primary key |
| movie | VARCHAR | Movie name |
| description | VARCHAR | Short description of the movie |
| rating | DECIMAL(4,2) | Movie rating (0 to 10) |
Example
Cinema
| id | movie | description | rating |
|---|---|---|---|
| 1 | War | great 3D | 8.9 |
| 2 | Science | fiction | 8.5 |
| 3 | irish | boring | 6.2 |
| 4 | Ice song | Fantacy | 8.6 |
| 5 | House card | Interesting | 9.1 |
Output
| id | movie | description | rating |
|---|---|---|---|
| 5 | House card | Interesting | 9.1 |
| 1 | War | great 3D | 8.9 |
Explanation:
Movies with odd IDs are 1, 3, 5. ID=3 is boring so excluded. IDs 5 and 1 remain, sorted by rating descending.
Approach hint
Start with a simple approach, explain the trade-off, then move toward a cleaner or more scalable solution.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
SQL Editor
Loading...
Cinema
| id | movie | description | rating |
|---|---|---|---|
| 1 | War | great 3D | 8.9 |
| 2 | Science | fiction | 8.5 |
| 3 | irish | boring | 6.2 |
| 4 | Ice song | Fantacy | 8.6 |
| 5 | House card | Interesting | 9.1 |
Output
| id | movie | description | rating |
|---|---|---|---|
| 5 | House card | Interesting | 9.1 |
| 1 | War | great 3D | 8.9 |