afonsoDistribution of $BONK Holders By Their Activity Status
    Updated 2023-04-13
    with t1 as (
    select trunc(block_timestamp, 'day')::date as day,
    tx_to as user_address,
    sum (amount) as total_amount
    from solana.core.fact_transfers
    where mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    group by day, user_address

    union all

    select trunc(block_timestamp, 'day')::date as day,
    tx_from as user_address,
    -1 * sum (amount) as total_amount
    from solana.core.fact_transfers
    where mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
    group by day, user_address

    ),

    t2 as (
    select day,
    user_address,
    sum (total_amount) as volume,
    sum (volume) over (partition by user_address order by day rows between unbounded preceding and current row) as user_total_amount
    from t1
    group by day, user_address
    )
    select case
    when user_total_amount < 100 then 'Less Than 100 BONK'
    when user_total_amount < 1000 then 'Between 100 and 1000 BONK'
    when user_total_amount < 10000 then 'Between 1000 and 10000 BONK'
    when user_total_amount < 100000 then 'Between 10,000 and 100,000 BONK'
    when user_total_amount < 1000000 then 'Between 100,000 and 1,000,000 BONK'
    when user_total_amount < 10000000 then 'Between 1,000,000 and 10,000,000 BONK'
    when user_total_amount < 100000000 then 'Between 10,000,000 and 100,000,000 BONK'
    Run a query to Download Data