binhachonGetting Your Feet Wet, Part 2 - Protocols with stats - Users
    Updated 2022-03-06
    with address_list as (
    select
    address,
    address_name,
    label_type,
    label_subtype,
    label
    from terra.labels
    -- where (label_type in ('dapp', 'defi', 'dex', 'layer2') or label_subtype = 'marketplace')
    -- and label_subtype not in ('token_contract', 'pool')
    ),
    new_user_list as (
    select
    block_timestamp,
    tx_from,
    row_number() over (partition by tx_from order by block_id) as rank
    from terra.transactions
    where tx_from[1] is null
    qualify rank = 1
    ),
    small_sample as (
    select
    *
    from terra.transactions
    where block_timestamp > getdate() - interval'30 days'
    and tx_from in (select tx_from from new_user_list where block_timestamp > getdate() - interval'30 days')
    ),
    final_table as (
    select
    address,
    address_name,
    label_type,
    label_subtype,
    label,
    tx_id,
    tx_from
    Run a query to Download Data