ji-0630 / CodingTest

코딩테스트 연습 기록
0 stars 0 forks source link

년, 월, 성별 별 상품 구매 회원 수 구하기 #265

Closed ji-0630 closed 1 year ago

ji-0630 commented 1 year ago

문제 설명

image image

ji-0630 commented 1 year ago

나의 풀이

SELECT year(SALES_DATE) as "YEAR", month(SALES_DATE) as "MONTH", gender, count(distinct u.USER_ID) as "USERS"
from USER_INFO u join ONLINE_SALE o
on u.USER_ID = o.USER_ID
where gender is not null
group by year(SALES_DATE), month(SALES_DATE), gender
order by year(SALES_DATE), month(SALES_DATE), gender