Filter movies by odd IDs and exclude the movie titled "boring", then sort the remaining rows by rating in descending order.
Given a table of movies, return all movies whose id is odd and whose description is not boring. Sort the result by rating from highest to lowest.
This is a simple data filtering and ordering problem: first apply the row conditions, then rank the remaining movies by rating.
You are given a Movies table with at least these columns:
idmoviedescriptionratingSelect the rows that satisfy the conditions described in the problem.
Return the filtered rows ordered by rating in descending order.
id values are integers.rating can be used for ordering.id and description <> 'boring' should appear in the output.Example 1
Input
Movies table +----+------------+-------------+--------+ | id | movie | description | rating | +----+------------+-------------+--------+ | 1 | War | great 3D | 8.9 | | 2 | Science | boring | 8.5 | | 3 | John | exciting | 8.0 | | 4 | Alice | boring | 6.5 | | 5 | Zebra | fun | 7.7 | +----+------------+-------------+--------+
Output
+----+------------+-------------+--------+ | id | movie | description | rating | +----+------------+-------------+--------+ | 1 | War | great 3D | 8.9 | | 3 | John | exciting | 8.0 | | 5 | Zebra | fun | 7.7 | +----+------------+-------------+--------+
Explanation
Keep only odd id rows and exclude any row whose description is boring, then sort by rating descending.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.