bertaNFT 7
    Updated 2023-01-06
    ------crediting Ali3N for this SQL
    with mintable as (
    select nft_address,
    min (date_trunc(month,block_timestamp)) as mindate
    from ethereum.core.ez_nft_sales
    where block_timestamp::date >= '2022-01-01' and block_timestamp::date < '2023-01-01'
    group by 1),

    maxtable as (
    select nft_address,
    max (date_trunc(month,block_timestamp)) as maxdate
    from ethereum.core.ez_nft_sales
    where block_timestamp::date >= '2022-01-01' and block_timestamp::date < '2023-01-01'
    group by 1),

    previous_table as (
    select t1.nft_address,
    coalesce (initcap(project_name),initcap(address_name),initcap(t1.nft_address)) as Project_Title,
    median (price_usd) as Previous_Price
    from ethereum.core.ez_nft_sales t1 left outer join ethereum.core.dim_labels t2 on t1.nft_address = t2.address
    join mintable t3 on t1.nft_address = t3.nft_address
    where price_usd > 0
    and date_trunc(month,block_timestamp) = mindate
    group by 1,2)

    select Project_Title,
    case when project_title = '0x45b5e0a3c6dae8c8170fd78268f807758226b67f' then 'AnifruktNFT (AFT)'
    when project_title = '0x6d1b09ae12adeaa3aa5d6b574dbcfaf7343a0b04' then 'Space Eggs (SPACE EGGS)'
    when project_title = '0x3f427073af2e9a26b0d5897435af9edd8b00efa6' then 'Ethnology (ETL)'
    when project_title = '0xb77bb4bda2e4cfec036f214594e758ac380d0f45' then 'Cool Cats Research Lab (CCLAB)'
    when project_title = '0xf22b1af401ff439728f426190e0b3e7b354ff9fa' then 'Gates Of Oxya - Colony (GoOC)'
    when project_title = '0x4483fcb6c4ba5614b5a3b9a2ebf2410901ebe507' then 'MKSM'
    when project_title = '0x8d25f9f4cd1c42d817e619f334848db47ccc8dca' then 'Tiny Tears (CRY)'
    when project_title = '0xa18cb1cdeb75eda5ad4a0922331723451dbcf5ed' then 'TheSaudisGoblin (TSG)'
    when project_title = '0x68cd21d362c2dae66909afd810e391fa152b2379' then 'Anime Metaverse: Soulmates (AMS)'
    else Project_Title end as project_title1,
    Run a query to Download Data