문제 설명
문제 풀이
SELECT YEAR(B.SALES_DATE) AS YEAR,
MONTH(B.SALES_DATE) AS MONTH,
A.GENDER AS GENDER,
COUNT(DISTINCT A.USER_ID) AS USERS
FROM USER_INFO A JOIN ONLINE_SALE B ON A.USER_ID = B.USER_ID
GROUP BY YEAR, MONTH, GENDER
HAVING GENDER IS NOT NULL
ORDER BY YEAR, MONTH, GENDER
실행 결과