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
- Method
- Stack
- Math
- bit manipulation
- implement
- Tree
- Matrix
- SQL
- sorting
- geometry
- Number Theory
- array
- Class
- 파이썬
- simulation
- Counting
- java
- two pointers
- 코테
- greedy
- 자바
- 구현
- 코딩테스트
- hash table
- Binary Tree
- string
- Data Structure
- Binary Search
- database
- dynamic programming
Archives
- Today
- Total
코린이의 소소한 공부노트
[LeetCode/Easy] 1757. Recyclable and Low Fat Products 본문
1. Input
1) Table: Products (pk: product_id)
- low_fats = ('Y', 'N'): 저지방이면 Y
- recyclable = ('Y', 'N'): 재활용 가능하면 Y
2. Output
1) 저지방이고 재활용 가능한 상품의 id를 출력
- 출력 순서는 상관 없다.
3. Example
4. Code
1) 첫 코드(2023/04/17)
select product_id
from (
select product_id, low_fats
from Products
where recyclable='Y'
) p
where low_fats='Y';
2) 서브 쿼리를 없애본 코드(2023/04/17)
select product_id
from Products
where low_fats='Y' and recyclable='Y';
- 두 코드의 큰 차이가 없는듯하다. 그냥 2번처럼 쓰는게 더 좋을 듯
'코딩테스트 풀이 > SQL' 카테고리의 다른 글
[LeetCode/Easy] 1890. The Latest Login in 2020 (0) | 2023.04.24 |
---|---|
[LeetCode/Easy] 1873. Calculate Special Bonus (0) | 2023.04.22 |
[LeetCode/Easy] 1741. Find Total Time Spent by Each Employee (0) | 2023.04.17 |
[LeetCode/Easy] 1693. Daily Leads and Partners (0) | 2023.04.15 |
[LeetCode/Easy] 1683. Invalid Tweets (0) | 2023.04.15 |