SQL 문제
[solvesql_Level2] 우리 플랫폼에 정착한 판매자 2
빙수빈수
2023. 10. 13. 10:16
https://solvesql.com/problems/settled-sellers-2/
https://solvesql.com/problems/settled-sellers-2/
solvesql.com
[코드]
select seller_id, count(distinct order_id) as orders
from olist_order_items_dataset
where price >= 50
group by seller_id
having orders >= 100
order by orders DESC;
[고찰]
이번 문제는 주문이 100건 이상인 컬럼들을 출력해야 하므로 집계함수 COUNT에 조건을 달아주기 위해 seller_id로 그룹을 묶어주고 having 절에 orders >= 100 조건을 주어 해결할 수 있었다.