inblog logo
|
silver
    SQL문제풀기

    [SQL문제풀기] Unique Users Per Client Per Month

    silver's avatar
    silver
    Jan 07, 2026
    [SQL문제풀기] Unique Users Per Client Per Month
    Contents
    문제내가 작성한 정답

    문제

    StrataScratch - Unique Users Per Client Per Month
    StrataScratch
    StrataScratch - Unique Users Per Client Per Month
    https://platform.stratascratch.com/coding/2024-unique-users-per-client-per-month?code_type=1

    내가 작성한 정답

    MySQL

    select client_id, month(time_id) as month, count(distinct user_id) as users_num from fact_events group by client_id, month(time_id) order by 1, 2;

    PostgreSQL, Oracle

    select client_id, extract(month from time_id) as month, count(distinct user_id) as users_num from fact_events group by client_id, extract(month from time_id) order by 1, 2;
    select client_id, to_number(to_char(time_id,'mm'),'99') as month, count(distinct user_id) as users_num from fact_events group by client_id, to_number(to_char(time_id,'mm'),'99') order by 1, 2;
    Share article

    silver

    RSS·Powered by Inblog