RamaharGetting Your Feet Wet, Part 1 [distribution]
Updated 2022-03-06Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
›
⌄
WITH ADDRESS AS (select
tx_from[0]::string as users,
min(block_timestamp::date) as TransactionDate
from terra.transactions
where block_timestamp::date >= CURRENT_DATE - 90 AND
tx_status = 'SUCCEEDED'
group by 1) ,
activewallet as (SELECT
tx_from[0]::string as senders,
count(distinct tx_id) as no_of_transactions
from terra.transactions t
inner join address a ON t.tx_from[0]::string = a.users
group by 1
order by 2 DESC )
SELECT
CASE
when no_of_transactions = 1 then 'Only 1 transaction made'
when no_of_transactions >= 2 and no_of_transactions <= 5 then '2-5 transactions made'
when no_of_transactions > 5 and no_of_transactions <= 10 then '6-10 transactions made'
when no_of_transactions > 10 then 'more than 10 transactions made'
end as TransactionMade,
count(distinct senders)
from activewallet
group by 1
Run a query to Download Data