2022-03-27 18:27:43 +08:00
< p > Table: < code > Products< / code > < / p >
< pre >
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| product_id | int |
| low_fats | enum |
| recyclable | enum |
+-------------+---------+
2023-12-09 18:42:21 +08:00
product_id is the primary key (column with unique values) for this table.
low_fats is an ENUM (category) of type (' Y' , ' N' ) where ' Y' means this product is low fat and ' N' means it is not.
recyclable is an ENUM (category) of types (' Y' , ' N' ) where ' Y' means this product is recyclable and ' N' means it is not.< / pre >
2022-03-27 18:27:43 +08:00
< p > < / p >
2023-12-09 18:42:21 +08:00
< p > Write a solution to find the ids of products that are both low fat and recyclable.< / p >
2022-03-27 18:27:43 +08:00
< p > Return the result table in < strong > any order< / strong > .< / p >
2023-12-09 18:42:21 +08:00
< p > The result format is in the following example.< / p >
2022-03-27 18:27:43 +08:00
< p > < / p >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 1:< / strong > < / p >
2022-03-27 18:27:43 +08:00
< pre >
< strong > Input:< / strong >
Products table:
+-------------+----------+------------+
| product_id | low_fats | recyclable |
+-------------+----------+------------+
| 0 | Y | N |
| 1 | Y | Y |
| 2 | N | Y |
| 3 | Y | Y |
| 4 | N | N |
+-------------+----------+------------+
< strong > Output:< / strong >
+-------------+
| product_id |
+-------------+
| 1 |
| 3 |
+-------------+
< strong > Explanation:< / strong > Only products 1 and 3 are both low fat and recyclable.
< / pre >