MySQL 실습 | Recyclable and Low Fat Products

2025. 1. 16. 10:40·SQL

문제 1.  Recyclable and Low Fat Products

Write a solution to find the ids of products that are both low fat and recyclable.
Return the result table in any order. 

The result format is in the following example.

Example 1:

Input: 
Products table:
+-------------+----------+------------+
| product_id  | low_fats | recyclable |
+-------------+----------+------------+
| 0           | Y        | N          |
| 1           | Y        | Y          |
| 2           | N        | Y          |
| 3           | Y        | Y          |
| 4           | N        | N          |
+-------------+----------+------------+
Output: 
+-------------+
| product_id  |
+-------------+
| 1           |
| 3           |
+-------------+
Explanation: Only products 1 and 3 are both low fat and recyclable.


💡 문제 풀이 

`내 풀이`

select product_id
from Products
where low_fats = 'Y' and recyclable = 'Y';

 

'SQL' 카테고리의 다른 글
  • MySQL 풀이 | 결제 없이 주문한 사용자 찾기 (난이도 중)
  • MySQL 풀이 | 지역별로 매출이 가장 높은 매장의 매출 찾기 (난이도 하)
  • MySQL 실습 | 상품을 구매한 회원 비율 구하기
  • MySQL 실습 | 자동차 대여 기록 별 대여 금액 구하기
초담
초담
4년차 마케터입니다
  • 초담
    그로스마케터의 기록
    초담
  • 전체
    오늘
    어제
  • 글쓰기 관리
    • 분류 전체보기 (117)
      • Data Analytics Project (3)
      • SQL (55)
      • Python (43)
      • GA4 (0)
      • Tableau (8)
      • 아티클 스터디 (7)
  • 인기 글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.2
초담
MySQL 실습 | Recyclable and Low Fat Products
상단으로

티스토리툴바