File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed 
src/main/java/g1701_1800/s1757_recyclable_and_low_fat_products Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ 1757\.  Recyclable and Low Fat Products
2+ 
3+ Easy
4+ 
5+ SQL Schema
6+ 
7+ Table: ` Products ` 
8+ 
9+  +-------------+---------+ 
10+  | Column Name | Type | 
11+  +-------------+---------+ 
12+  | product_id | int | 
13+  | low_fats | enum | 
14+  | recyclable | enum | 
15+  +-------------+---------+ 
16+  product_id is the primary key for this table. 
17+  low_fats is an ENUM of type ('Y', 'N') where 'Y' means this product is low fat and 'N' means it is not. 
18+  recyclable is an ENUM of types ('Y', 'N') where 'Y' means this product is recyclable and 'N' means it is not. 
19+ 
20+ Write an SQL query to find the ids of products that are both low fat and recyclable.
21+ 
22+ Return the result table in ** any order** .
23+ 
24+ The query result format is in the following example.
25+ 
26+ ** Example 1:** 
27+ 
28+ ** Input:** 
29+ 
30+  Products table: 
31+  +-------------+----------+------------+ 
32+  | product_id | low_fats | recyclable | 
33+  +-------------+----------+------------+ 
34+  | 0 | Y | N | 
35+  | 1 | Y | Y | 
36+  | 2 | N | Y | 
37+  | 3 | Y | Y | 
38+  | 4 | N | N | 
39+  +-------------+----------+------------+ 
40+ 
41+ ** Output:** 
42+ 
43+  +-------------+ 
44+  | product_id | 
45+  +-------------+ 
46+  | 1 | 
47+  | 3 | 
48+  +-------------+ 
49+ 
50+ ** Explanation:**  Only products 1 and 3 are both low fat and recyclable. 
Original file line number Diff line number Diff line change 1+ #  Write your MySQL query statement below
2+ #  #Easy #Database #SQL_I_Day_1_Select #2022_05_03_Time_475_ms_(71.54%)_Space_0B_(100.00%)
3+ select  product_id from  Products 
4+ where  low_fats= ' Y' and  recyclable= ' Y' 
                         You can’t perform that action at this time. 
           
                  
0 commit comments