mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
50 lines
1.8 KiB
HTML
50 lines
1.8 KiB
HTML
<p>表:<code>cinema</code></p>
|
||
|
||
<pre>
|
||
+----------------+----------+
|
||
| Column Name | Type |
|
||
+----------------+----------+
|
||
| id | int |
|
||
| movie | varchar |
|
||
| description | varchar |
|
||
| rating | float |
|
||
+----------------+----------+
|
||
id 是该表的主键(具有唯一值的列)。
|
||
每行包含有关电影名称、类型和评级的信息。
|
||
评级为 [0,10] 范围内的小数点后 2 位浮点数。
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p>编写解决方案,找出所有影片描述为 <strong>非</strong> <code>boring</code> (不无聊) 的并且<strong> id 为奇数 </strong>的影片。</p>
|
||
|
||
<p>返回结果按 <code>rating</code> <strong>降序排列</strong>。</p>
|
||
|
||
<p>结果格式如下示例。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>
|
||
+---------+-----------+--------------+-----------+
|
||
| id | movie | description | rating |
|
||
+---------+-----------+--------------+-----------+
|
||
| 1 | War | great 3D | 8.9 |
|
||
| 2 | Science | fiction | 8.5 |
|
||
| 3 | irish | boring | 6.2 |
|
||
| 4 | Ice song | Fantacy | 8.6 |
|
||
| 5 | House card| Interesting| 9.1 |
|
||
<strong>+---------+-----------+--------------+-----------+
|
||
输出:</strong>
|
||
+---------+-----------+--------------+-----------+
|
||
| id | movie | description | rating |
|
||
+---------+-----------+--------------+-----------+
|
||
| 5 | House card| Interesting| 9.1 |
|
||
| 1 | War | great 3D | 8.9 |
|
||
+---------+-----------+--------------+-----------+
|
||
<strong>解释:</strong>
|
||
我们有三部电影,它们的 id 是奇数:1、3 和 5。id = 3 的电影是 boring 的,所以我们不把它包括在答案中。
|
||
</pre>
|