|
| 1 | +<h2><a href="https://leetcode.com/problems/not-boring-movies/">620. Not Boring Movies</a></h2><h3>Easy</h3><hr><div class="sql-schema-wrapper__3VBi"><a class="sql-schema-link__3cEg">SQL Schema<svg viewBox="0 0 24 24" width="1em" height="1em" class="icon__1Md2"><path fill-rule="evenodd" d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></svg></a></div><div><p>Table: <code>Cinema</code></p> |
| 2 | + |
| 3 | +<pre>+----------------+----------+ |
| 4 | +| Column Name | Type | |
| 5 | ++----------------+----------+ |
| 6 | +| id | int | |
| 7 | +| movie | varchar | |
| 8 | +| description | varchar | |
| 9 | +| rating | float | |
| 10 | ++----------------+----------+ |
| 11 | +id is the primary key for this table. |
| 12 | +Each row contains information about the name of a movie, its genre, and its rating. |
| 13 | +rating is a 2 decimal places float in the range [0, 10] |
| 14 | +</pre> |
| 15 | + |
| 16 | +<p> </p> |
| 17 | + |
| 18 | +<p>Write an SQL query to report the movies with an odd-numbered ID and a description that is not <code>"boring"</code>.</p> |
| 19 | + |
| 20 | +<p>Return the result table ordered by <code>rating</code> <strong>in descending order</strong>.</p> |
| 21 | + |
| 22 | +<p>The query result format is in the following example.</p> |
| 23 | + |
| 24 | +<p> </p> |
| 25 | +<p><strong>Example 1:</strong></p> |
| 26 | + |
| 27 | +<pre><strong>Input:</strong> |
| 28 | +Cinema table: |
| 29 | ++----+------------+-------------+--------+ |
| 30 | +| id | movie | description | rating | |
| 31 | ++----+------------+-------------+--------+ |
| 32 | +| 1 | War | great 3D | 8.9 | |
| 33 | +| 2 | Science | fiction | 8.5 | |
| 34 | +| 3 | irish | boring | 6.2 | |
| 35 | +| 4 | Ice song | Fantacy | 8.6 | |
| 36 | +| 5 | House card | Interesting | 9.1 | |
| 37 | ++----+------------+-------------+--------+ |
| 38 | +<strong>Output:</strong> |
| 39 | ++----+------------+-------------+--------+ |
| 40 | +| id | movie | description | rating | |
| 41 | ++----+------------+-------------+--------+ |
| 42 | +| 5 | House card | Interesting | 9.1 | |
| 43 | +| 1 | War | great 3D | 8.9 | |
| 44 | ++----+------------+-------------+--------+ |
| 45 | +<strong>Explanation:</strong> |
| 46 | +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. |
| 47 | +</pre> |
| 48 | +</div> |
0 commit comments