JOIN ON
WHERE
또는 HAVING
GROUP BY
, ORDER BY
DISTINCT
, COUNT
SELECT YEAR(SALES_DATE) YEAR, MONTH(SALES_DATE) MONTH, GENDER, COUNT(DISTINCT U.USER_ID) USERS
FROM USER_INFO U JOIN ONLINE_SALE O
ON U.USER_ID = O.USER_ID
WHERE U.GENDER IS NOT NULL
GROUP BY 1, 2, 3
ORDER BY 1, 2, 3