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 |
Tags
- 처음 만나는 AI수학 with Python
- 친절한SQL튜닝
- 리눅스
- 서버설정
- 선형대수
- Kernighan의 C언어 프로그래밍
- 코드로배우는스프링부트웹프로젝트
- 네트워크 설정
- 처음 만나는 AI 수학 with Python
- 티스토리 쿠키 삭제
- baeldung
- 이터레이터
- /etc/network/interfaces
- 자료구조와 함께 배우는 알고리즘 입문
- resttemplate
- network configuration
- 자바편
- ㅒ
- 구멍가게코딩단
- 코드로배우는스프링웹프로젝트
- 페이징
- 스프링부트핵심가이드
- iterator
- 데비안
- 자료구조와함께배우는알고리즘입문
- 스프링 시큐리티
- 목록처리
- 알파회계
- d
- 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