11. Odd Non-Boring Movies

A movie streaming platform maintains a database of movies. The content curation team wants to feature movies that are more engaging and unique.

The company maintains a Cinema table that contains:

╔═════════════╦══════════╗
ā•‘ Column Name ā•‘   Type   ā•‘
╠═════════════╬══════════╣
ā•‘     id      ā•‘   int    ā•‘
║─────────────┼──────────║
ā•‘    movie    ā•‘ varchar  ā•‘
║─────────────┼──────────║
ā•‘ description ā•‘ varchar  ā•‘
║─────────────┼──────────║
ā•‘   rating    ā•‘  float   ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•©ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•
  • id: A unique (primary key) integer representing each movie.
  • movie: The title of the movie.
  • description: A short summary or keyword describing the movie.
  • rating: A float (2 decimal places) from 0 to 10 indicating the movie's rating.

The task is to:

  1. Filter movies where the id is an odd number.
  2. Exclude any movie where the description is exactly 'boring'.
  3. Sort the results by rating in descending order.

The sample output format is in the following example.

Example 1:

Input:

Cinema Table:

╔══════════╦══════════════╦═════════════╦══════════╗
ā•‘    id    ā•‘    movie     ā•‘ description ā•‘  rating  ā•‘
╠══════════╬══════════════╬═════════════╬══════════╣
ā•‘    1     ā•‘ Galaxy Raid  ā•‘  great 3D   ā•‘   8.9    ā•‘
║──────────┼──────────────┼─────────────┼──────────║
ā•‘    2     ā•‘ Future Code  ā•‘   fiction   ā•‘   8.5    ā•‘
║──────────┼──────────────┼─────────────┼──────────║
ā•‘    3     ā•‘  Old Times   ā•‘   boring    ā•‘   6.2    ā•‘
║──────────┼──────────────┼─────────────┼──────────║
ā•‘    4     ā•‘ Winter Dream ā•‘   Fantacy   ā•‘   8.6    ā•‘
║──────────┼──────────────┼─────────────┼──────────║
ā•‘    5     ā•‘ Silent Echo  ā•‘ Interesting ā•‘   9.1    ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•©ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•©ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•©ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•

Output:

╔══════════╦═════════════╦═════════════╦══════════╗
ā•‘    id    ā•‘    movie    ā•‘ description ā•‘  rating  ā•‘
╠══════════╬═════════════╬═════════════╬══════════╣
ā•‘    5     ā•‘ Silent Echo ā•‘ Interesting ā•‘   9.1    ā•‘
║──────────┼─────────────┼─────────────┼──────────║
ā•‘    1     ā•‘ Galaxy Raid ā•‘  great 3D   ā•‘   8.9    ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•©ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•©ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•©ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•

Explanation:

  • ID 1 (Galaxy Raid) - Odd ID, description is not 'boring' → Included
  • ID 3 (Old Times) - Odd ID, but description is 'boring' → Excluded
  • ID 5 (Silent Echo) - Odd ID, description is not 'boring' → Included
  • ID 2, 4 - Even IDs → Excluded

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Hints

0
Ā 
Test Case

Input:

Cinema