SQL/StrataScratch
[MySQL] (Medium) Apple Product Counts
oatmeal
2024. 2. 15. 13:08
문제: https://platform.stratascratch.com/coding/10141-apple-product-counts/official-solution?code_type=3
나의풀이:
select language
, count(distinct(case when device in ('macbook pro', 'iphone 5s', 'ipad air') then user_id end)) as n_apple_user
, count(distinct user_id) as n_total_users
from playbook_events e
join playbook_users u using (user_id)
group by language
order by 3 desc;
정답~~예엥 솔루션도 똑같다!
처음에는 틀렸는데 문제는 MacBook-Pro 라고 되어있지만 데이터에서는 macbook pro 이렇게 되어있어서 그런 부분들을 수정해줬더니 맞췄당,, 근데 대문자, - 를 포함했을때도 카운트 값이 있었는데 ?.? 문제가 약간 이상한 것 같기도,,