Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- /etc/network/interfaces
- 선형대수
- 자바편
- 코드로배우는스프링부트웹프로젝트
- 서버설정
- resttemplate
- 이터레이터
- iterator
- 페이징
- 네트워크 설정
- 자료구조와함께배우는알고리즘입문
- 데비안
- 친절한SQL튜닝
- ㅒ
- Kernighan의 C언어 프로그래밍
- 티스토리 쿠키 삭제
- 리눅스
- 코드로배우는스프링웹프로젝트
- 알파회계
- baeldung
- 스프링부트핵심가이드
- 구멍가게코딩단
- d
- 자료구조와 함께 배우는 알고리즘 입문
- 스프링 시큐리티
- network configuration
- 목록처리
- 처음 만나는 AI수학 with Python
- 처음 만나는 AI 수학 with Python
- GIT
Archives
- Today
- Total
bright jazz music
1757. Recyclable and Low Fat Products 본문
Algorithm Practice/LeetCode
1757. Recyclable and Low Fat Products
bright jazz music 2022. 11. 26. 21:16Table: Products
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| product_id | int |
| low_fats | enum |
| recyclable | enum |
+-------------+---------+
product_id is the primary key for this table.
low_fats is an ENUM of type ('Y', 'N') where 'Y' means this product is low fat and 'N' means it is not.
recyclable is an ENUM of types ('Y', 'N') where 'Y' means this product is recyclable and 'N' means it is not.
Write an SQL query to find the ids of products that are both low fat and recyclable.
Return the result table in any order.
The query 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.
---
solution
# Write your MySQL query statement below
select product_id from products where low_fats='Y' and recyclable='Y';'Algorithm Practice > LeetCode' 카테고리의 다른 글
| 605. Can place flowers (0) | 2026.01.13 |
|---|---|
| 1. Two Sum (1) | 2022.11.27 |
| 183. Customers Who Never Order (0) | 2022.11.26 |
| 584. Find Customer Referee (0) | 2022.11.26 |
| 595. Big Countries (0) | 2022.11.25 |
Comments