2022-03-27 20:45:09 +08:00
|
|
|
|
<p>表:<code>Products</code></p>
|
|
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
|
+-------------+---------+
|
|
|
|
|
| Column Name | Type |
|
|
|
|
|
+-------------+---------+
|
|
|
|
|
| product_id | int |
|
|
|
|
|
| low_fats | enum |
|
|
|
|
|
| recyclable | enum |
|
|
|
|
|
+-------------+---------+
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<code>product_id</code> 是该表的主键(具有唯一值的列)。
|
2022-03-27 20:45:09 +08:00
|
|
|
|
low_fats 是枚举类型,取值为以下两种 ('Y', 'N'),其中 'Y' 表示该产品是低脂产品,'N' 表示不是低脂产品。
|
|
|
|
|
recyclable 是枚举类型,取值为以下两种 ('Y', 'N'),其中 'Y' 表示该产品可回收,而 'N' 表示不可回收。</pre>
|
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p> </p>
|
2022-03-27 20:45:09 +08:00
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p>编写解决方案找出既是低脂又是可回收的产品编号。</p>
|
2022-03-27 20:45:09 +08:00
|
|
|
|
|
|
|
|
|
<p>返回结果 <strong>无顺序要求</strong> 。</p>
|
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p>返回结果格式如下例所示:</p>
|
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
|
|
<p><strong>示例 1:</strong></p>
|
2022-03-27 20:45:09 +08:00
|
|
|
|
|
|
|
|
|
<pre>
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<strong>输入:</strong>
|
2022-03-27 20:45:09 +08:00
|
|
|
|
Products 表:
|
|
|
|
|
+-------------+----------+------------+
|
|
|
|
|
| product_id | low_fats | recyclable |
|
|
|
|
|
+-------------+----------+------------+
|
|
|
|
|
| 0 | Y | N |
|
|
|
|
|
| 1 | Y | Y |
|
|
|
|
|
| 2 | N | Y |
|
|
|
|
|
| 3 | Y | Y |
|
|
|
|
|
| 4 | N | N |
|
|
|
|
|
+-------------+----------+------------+
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<strong>输出:</strong>
|
2022-03-27 20:45:09 +08:00
|
|
|
|
+-------------+
|
|
|
|
|
| product_id |
|
|
|
|
|
+-------------+
|
|
|
|
|
| 1 |
|
|
|
|
|
| 3 |
|
|
|
|
|
+-------------+
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<strong>解释:</strong>
|
2022-03-27 20:45:09 +08:00
|
|
|
|
只有产品 id 为 1 和 3 的产品,既是低脂又是可回收的产品。
|
|
|
|
|
</pre>
|