kiacryptoNEAR distribution among holders
    Updated 2022-09-08
    with holders as (
    select tx_signer as address, sum(deposit/1e24) as volume
    from near.core.fact_transfers
    group by 1
    union all
    select tx_receiver as address, -sum(deposit/1e24) as volume
    from near.core.fact_transfers
    group by 1
    ),
    bal as (
    select address, sum(volume) as balance
    from holders
    group by 1 having balance > 0
    )

    select case
    when balance <= 1 then '(0, 1]'
    when balance <= 10 then '(1, 10]'
    when balance <= 100 then '(10, 100]'
    when balance <= 1000 then '(100, 1K]'
    when balance <= 10000 then '(1K, 10K]'
    when balance <= 100000 then '(10K, 100K]'
    when balance <= 1000000 then '(100K, 1M]'
    else 'more than 1M' end as dis, count(*)
    from bal
    group by 1
    Run a query to Download Data