cypherForefront Holder Distribution
    Updated 2022-04-19
    with data as (select balance from
    ethereum.erc20_balances
    where balance_date = current_date()
    and contract_address = lower('0x7e9d8f07a64e363e97a648904a89fb4cd5fb94cd')),

    final_values as (select
    count(case when balance <= 10 then 1 end) as "1. 0 - 10 FF",
    count(case when balance > 10 and balance <= 50 then 1 end) as "2. 10 - 50 FF",
    count(case when balance > 50 and balance <= 100 then 1 end) as "3. 50 - 100 FF",
    count(case when balance > 100 and balance <= 200 then 1 end) as "4. 100 - 200 FF",
    count(case when balance > 200 and balance <= 500 then 1 end) as "5. 200 - 500 FF",
    count(case when balance > 500 and balance <= 1000 then 1 end) as "6. 500 - 1000 FF",
    count(case when balance > 500 and balance <= 1000 then 1 end) as "7. 1000 - 2000 FF",
    count(case when balance > 500 and balance <= 1000 then 1 end) as "8. 2000 - 5000 FF",
    count(case when balance > 5000 then 1 end) as "9. 5000+ FF"
    from data)

    select bin, n
    from final_values
    unpivot(
    n
    for bin in ("1. 0 - 10 FF", "2. 10 - 50 FF", "3. 50 - 100 FF", "4. 100 - 200 FF", "5. 200 - 500 FF", "6. 500 - 1000 FF", "7. 1000 - 2000 FF", "8. 2000 - 5000 FF", "9. 5000+ FF")

    )u
    Run a query to Download Data