๋ฐ์ํ
https://school.programmers.co.kr/learn/courses/30/lessons/131532
USER_INFO ํ ์ด๋ธ๊ณผ ONLINE_SALE ํ ์ด๋ธ์์
๋ , ์, ์ฑ๋ณ ๋ณ๋ก
์ํ์ ๊ตฌ๋งคํ ํ์์๋ฅผ ์ง๊ณํ๋ SQL๋ฌธ์ ์์ฑํด์ฃผ์ธ์.
๊ฒฐ๊ณผ๋ ๋ , ์, ์ฑ๋ณ์ ๊ธฐ์ค์ผ๋ก ์ค๋ฆ์ฐจ์ ์ ๋ ฌํด์ฃผ์ธ์.
์ด๋, ์ฑ๋ณ ์ ๋ณด๊ฐ ์๋ ๊ฒฝ์ฐ ๊ฒฐ๊ณผ์์ ์ ์ธํด์ฃผ์ธ์.
select year(sales_date) as year, month(sales_date) as month, gender,
count(distinct s.user_id) as users
from user_info i join online_sale s on i.user_id = s.user_id
where gender is not null
group by year, month, gender
order by year, month, gender
๋ฐ์ํ