Eman-RazClassification of Users Based on the Number of Projects Purchased
Updated 2023-04-19
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
27
28
29
30
31
32
33
34
›
⌄
with table2 as (with table1 as (with tab1 as (select date_trunc('day',block_timestamp) as day, tx_hash,
nft_address, project_name, nft_from_address, nft_to_address, tokenid
from ethereum.core.ez_nft_transfers),
tab2 as (select date_trunc('day',block_timestamp) as day, tx_hash, from_address, tx_fee, eth_value
from ethereum.core.fact_transactions
where to_address='0x74312363e45dcaba76c59ec49a7aa8a65a67eed3' --X2Y2: Exchange
and eth_value<>0)
select tab1.day as date, tab1.tx_hash as tx_id, nft_address, project_name, nft_from_address as nft_seller,
from_address as nft_purchaser, tokenid, tx_fee, eth_value
from tab1 left join tab2 on tab1.tx_hash=tab2.tx_hash and tab1.nft_to_address=tab2.from_address
order by 1)
select nft_purchaser, count(distinct nft_address) as project_count, case
when project_count=1 then 'n=1'
when project_count=2 then 'n=2'
when project_count=3 then 'n=3'
when project_count=4 then 'n=4'
when project_count=5 then 'n=5'
when project_count>5 and project_count<=10 then '5<n<=10'
when project_count>10 and project_count<=20 then '10<n<=20'
when project_count>20 and project_count<=30 then '20<n<=30'
when project_count>30 and project_count<=40 then '30<n<=40'
when project_count>40 and project_count<=50 then '40<n<=50'
when project_count>50 and project_count<=100 then '50<n<=100'
when project_count>100 then 'n>100'
end as group_
from table1
where nft_purchaser is not null
group by 1)
select group_,count(nft_purchaser) as user_count
from table2
group by 1
order by 2
Run a query to Download Data