eferHistogram - What is the average ALGO holding of these new wallets?
    Updated 2022-06-16
    WITH accounts AS (
    SELECT * FROM flipside_prod_db.algorand.account
    ), blocks AS (
    SELECT * FROM flipside_prod_db.algorand.block
    ), main AS (
    SELECT
    accounts.ADDRESS AS address,
    blocks.BLOCK_TIMESTAMP AS created_at,
    accounts.BALANCE AS balance,
    accounts.ACCOUNT_DATA AS metadata
    FROM accounts, blocks
    WHERE blocks.BLOCK_ID = accounts.CREATED_AT
    AND accounts.ACCOUNT_CLOSED = FALSE
    ORDER BY created_at DESC
    ), may_wallets_one_algo AS (
    SELECT address, balance FROM main
    WHERE created_at > '2022-05-01' AND created_at < '2022-06-01'
    AND balance > 1
    ), histo_bins AS (
    SELECT
    floor(balance/10000.00)*1000 AS bin_floor,
    COUNT(address) AS count
    FROM may_wallets_one_algo
    GROUP BY 1
    ORDER BY 1
    )

    SELECT
    bin_floor,
    bin_floor || ' - ' || (bin_floor + 1000) as bin_range,
    count AS addresses
    FROM histo_bins
    ORDER BY 1;
    Run a query to Download Data