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