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