boomer77wealth equality by ust balance
Updated 2021-12-09
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
›
⌄
with raw as (select *, case
when balance < 100 then '1_Less_than_100'
when balance between 100 and 1000 then '2_Between_$100_to_$1000'
when balance between 1000 and 10000 then '3_Between_$1000_to_$10,000'
when balance between 10000 and 100000 then '4_Between_$10,000_to_$100,000'
when balance between 100000 and 1000000 then '5_Between_$100,000_to_$1,000,000'
when balance between 1000000 and 10000000 then '6_Between_$1,000,000_to_$10,000,000'
else '7_Over_$10,000,000' end as cat
from terra.daily_balances
where currency = 'UST' and date = CURRENT_DATE - 1 and address_name is null and balance > 0
order by balance desc)
select cat, count(distinct address) as count, sum(balance_usd) sum_by_category
from raw
group by 1
Run a query to Download Data