Hemin5 distribution of ALGO holdings for these new wallets
    Updated 2022-06-15
    with
    balance as (-- How many wallets have a balance greater than 1 ALGO?
    select
    DISTINCT address
    from flipside_prod_db.algorand.account
    where BALANCE > 1
    and ACCOUNT_CLOSED = FALSE
    )
    , tx as (--And how many of those wallets sent or received a transaction in May?
    select count(DISTINCT SENDER )
    from flipside_prod_db.algorand.transactions
    where block_timestamp::date BETWEEN '2022-05-01' and '2022-05-31'
    and SENDER in (select * from balance )
    )
    ,neww as (select --How many new wallets were created in May?
    DISTINCT address
    from flipside_prod_db.algorand.account a INNER JOIN flipside_prod_db.algorand.block b on a.created_at = b.block_id
    where b.block_timestamp::date BETWEEN '2022-05-01' and '2022-05-31'
    and ACCOUNT_CLOSED = FALSE
    )
    , percent as ( -- What % of total wallets with more than 1 ALGO is this?
    select count(DISTINCT n.address ) as new_users , count(DISTINCT b.address ) as total , new_users/ total *100
    from neww n , balance b
    where n.address in (select * from balance )
    -- GROUP by new_users
    )
    -- Additionally, show the distribution of ALGO holdings for these new wallets. What is the average ALGO holding of these new wallets?
    , dis as (select
    case
    when balance BETWEEN 0 and 5 then 'less then 5'
    when balance BETWEEN 5 and 50 then '5-50'
    when balance BETWEEN 50 and 500 then '50-500'
    when balance BETWEEN 500 and 1000 then '500-1000'
    else 'more than 1000' end as balanceg,
    sum(balance) ,avg(balance) as balance_avg , count(address)
    Run a query to Download Data