[SQL문제풀기] 가구 판매의 비중이 높았던 날 찾기

silver's avatar
Sep 25, 2025
[SQL문제풀기] 가구 판매의 비중이 높았던 날 찾기
Contents
문제SQLite

문제

SQLite

내가 작성한 정답

→ distinct!!로 잘 걸러내야한다
select order_date, count(distinct case when category = 'Furniture' then order_id end) furniture, round((count(distinct case when category = 'Furniture' then order_id end)*100.00/count(distinct order_id)*1.0),2) furniture_pct from records group by order_date having count(distinct order_id) >= 10 and (count(distinct case when category = 'Furniture' then order_id end)*100.00/count(distinct order_id)*1.0) >= 40 order by 3 desc, 1;
 
Share article

silver