Interview Questions/SQL/Not Boring Movies

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 NameTypeDescription
idINTPrimary key
movieVARCHARMovie name
descriptionVARCHARShort description of the movie
ratingDECIMAL(4,2)Movie rating (0 to 10)

Example

Cinema

idmoviedescriptionrating
1Wargreat 3D8.9
2Sciencefiction8.5
3irishboring6.2
4Ice songFantacy8.6
5House cardInteresting9.1

Output

idmoviedescriptionrating
5House cardInteresting9.1
1Wargreat 3D8.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

idmoviedescriptionrating
1Wargreat 3D8.9
2Sciencefiction8.5
3irishboring6.2
4Ice songFantacy8.6
5House cardInteresting9.1

Output

idmoviedescriptionrating
5House cardInteresting9.1
1Wargreat 3D8.9