Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Useful for preparing for technical interviews and improving your SQL skills.

### Select

- [1757. Recyclable and Low Fat Products](./leetcode/easy/1757.%20Recyclable%20and%20Low%20Fat%20Products.sql)
- [584. Find Customer Referee](./leetcode/easy/584.%20Find%20Customer%20Referee.sql)
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
- [1148. Article Views I](./leetcode/easy/1148.%20Article%20Views%20I.sql)
Expand Down Expand Up @@ -148,6 +149,7 @@ Useful for preparing for technical interviews and improving your SQL skills.
- [1729. Find Followers Count](./leetcode/easy/1729.%20Find%20Followers%20Count.sql)
- [1731. The Number of Employees Which Report to Each Employee](./leetcode/easy/1731.%20The%20Number%20of%20Employees%20Which%20Report%20to%20Each%20Employee.sql)
- [1741. Find Total Time Spent by Each Employee](./leetcode/easy/1741.%20Find%20Total%20Time%20Spent%20by%20Each%20Employee.sql)
- [1757. Recyclable and Low Fat Products](./leetcode/easy/1757.%20Recyclable%20and%20Low%20Fat%20Products.sql)
- [1789. Primary Department for Each Employee](./leetcode/easy/1789.%20Primary%20Department%20for%20Each%20Employee.sql)
- [1795. Rearrange Products Table](./leetcode/easy/1795.%20Rearrange%20Products%20Table.sql)
- [1873. Calculate Special Bonus](./leetcode/easy/1873.%20Calculate%20Special%20Bonus.sql)
Expand Down
26 changes: 26 additions & 0 deletions leetcode/easy/1757. Recyclable and Low Fat Products.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Question 1757. Recyclable and Low Fat Products
Link: https://leetcode.com/problems/recyclable-and-low-fat-products/description/?envType=problem-list-v2&envId=database

Table: Products

+-------------+---------+
| Column Name | Type |
+-------------+---------+
| product_id | int |
| low_fats | enum |
| recyclable | enum |
+-------------+---------+
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.


Write a solution to find the ids of products that are both low fat and recyclable.

Return the result table in any order.
*/

SELECT product_id
FROM products
WHERE low_fats = 'Y' AND recyclable = 'Y'