|
| 1 | +<p>Table: <code>Cinema</code></p> |
| 2 | + |
| 3 | +<pre> |
| 4 | ++----------------+----------+ |
| 5 | +| Column Name | Type | |
| 6 | ++----------------+----------+ |
| 7 | +| id | int | |
| 8 | +| movie | varchar | |
| 9 | +| description | varchar | |
| 10 | +| rating | float | |
| 11 | ++----------------+----------+ |
| 12 | +id is the primary key (column with unique values) for this table. |
| 13 | +Each row contains information about the name of a movie, its genre, and its rating. |
| 14 | +rating is a 2 decimal places float in the range [0, 10] |
| 15 | +</pre> |
| 16 | + |
| 17 | +<p> </p> |
| 18 | + |
| 19 | +<p>Write a solution to report the movies with an odd-numbered ID and a description that is not <code>"boring"</code>.</p> |
| 20 | + |
| 21 | +<p>Return the result table ordered by <code>rating</code> <strong>in descending order</strong>.</p> |
| 22 | + |
| 23 | +<p>The result format is in the following example.</p> |
| 24 | + |
| 25 | +<p> </p> |
| 26 | +<p><strong class="example">Example 1:</strong></p> |
| 27 | + |
| 28 | +<pre> |
| 29 | +<strong>Input:</strong> |
| 30 | +Cinema table: |
| 31 | ++----+------------+-------------+--------+ |
| 32 | +| id | movie | description | rating | |
| 33 | ++----+------------+-------------+--------+ |
| 34 | +| 1 | War | great 3D | 8.9 | |
| 35 | +| 2 | Science | fiction | 8.5 | |
| 36 | +| 3 | irish | boring | 6.2 | |
| 37 | +| 4 | Ice song | Fantacy | 8.6 | |
| 38 | +| 5 | House card | Interesting | 9.1 | |
| 39 | ++----+------------+-------------+--------+ |
| 40 | +<strong>Output:</strong> |
| 41 | ++----+------------+-------------+--------+ |
| 42 | +| id | movie | description | rating | |
| 43 | ++----+------------+-------------+--------+ |
| 44 | +| 5 | House card | Interesting | 9.1 | |
| 45 | +| 1 | War | great 3D | 8.9 | |
| 46 | ++----+------------+-------------+--------+ |
| 47 | +<strong>Explanation:</strong> |
| 48 | +We have three movies with odd-numbered IDs: 1, 3, and 5. The movie with ID = 3 is boring so we do not include it in the answer. |
| 49 | +</pre> |
0 commit comments