You are given a Products table containing information about products and their properties.
The table has the following structure:
product_id: Primary key identifying each productlow_fats: ENUM with values 'Y' (low fat) or 'N' (not low fat)recyclable: ENUM with values 'Y' (recyclable) or 'N' (not recyclable)
Write a SQL query to find the product IDs of products that are both low fat AND recyclable.
Return the result in any order.
Table Schema
| Column Name | Type | Description |
|---|---|---|
product_id
PK
|
int | Primary key identifying each product |
low_fats
|
enum | ENUM('Y', 'N') where 'Y' means low fat, 'N' means not low fat |
recyclable
|
enum | ENUM('Y', 'N') where 'Y' means recyclable, 'N' means not recyclable |
Input & Output
| product_id | low_fats | recyclable |
|---|---|---|
| 0 | Y | N |
| 1 | Y | Y |
| 2 | N | Y |
| 3 | Y | Y |
| 4 | N | N |
| product_id |
|---|
| 1 |
| 3 |
Products 1 and 3 are both low fat (low_fats = 'Y') and recyclable (recyclable = 'Y'). Product 0 is low fat but not recyclable, product 2 is recyclable but not low fat, and product 4 is neither.
| product_id | low_fats | recyclable |
|---|---|---|
| 5 | Y | N |
| 6 | N | Y |
| 7 | N | N |
| product_id |
|---|
No products satisfy both conditions. Product 5 is low fat but not recyclable, product 6 is recyclable but not low fat, and product 7 is neither low fat nor recyclable.
| product_id | low_fats | recyclable |
|---|---|---|
| 8 | Y | Y |
| 9 | Y | Y |
| product_id |
|---|
| 8 |
| 9 |
Both products are low fat and recyclable, so both product IDs are returned in the result.
Constraints
-
1 ≤ product_id ≤ 1000 -
low_fatsis an ENUM of type('Y', 'N') -
recyclableis an ENUM of type('Y', 'N')