select BLOCK_TIMESTAMP::date as date,sum(LOAN_AMOUNT_USD)as borrow_amount
,sum(borrow_amount)over(order by date)as cumulative_borrowed
, case
when date>='2020-05-05'and date<'2021-01-01' then '2020'
when date>='2021-01-01'and date<'2022-01-01' then '2021'
when date>='2020-01-01' then '2022' end as time_period
from ethereum.compound.ez_borrows
where date>='2020-05-05'
group by 1