moonshot21Course 3 - Homework 3
Updated 2024-08-22
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
35
36
›
⌄
-- For Pudgy Penguins NFT, find the % of NFTs the top 5 wallet holds
WITH raw AS (
SELECT
block_timestamp,
tx_hash,
nft_from_address,
nft_to_address,
nft_address,
tokenid,
event_index,
project_name
FROM
ethereum.nft.ez_nft_transfers
WHERE
nft_address = LOWER('0xBd3531dA5CF5857e7CfAA92426877b022e612cf8')
QUALIFY
ROW_NUMBER() OVER (PARTITION BY tokenid ORDER BY block_timestamp DESC, event_index DESC) = 1 -- Get the latest transfers per token id
),
holdings AS (
SELECT
nft_to_address,
COUNT(1) AS holdings
FROM
raw
GROUP BY
nft_to_address
),
top5 AS (
SELECT
nft_to_address,
holdings
FROM
holdings
QueryRunArchived: QueryRun has been archived