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:
- Filter movies where the id is an odd number.
- Exclude any movie where the description is exactly 'boring'.
- 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.