dannyamah1 Year Percentage Change
Updated 2024-05-21
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
›
⌄
SELECT
((end_price1 - start_price1) / start_price1) * 100 AS percentage_change_2012,
((end_price2 - start_price2) / start_price2) * 100 AS percentage_change_2016,
((end_price3 - start_price3) / start_price3) * 100 AS percentage_change_2020,
((end_price4 - start_price4) / start_price4) * 100 AS percentage_change_2024
FROM
(
SELECT
(SELECT AVG(price) FROM bitcoin.price.ez_hourly_token_prices WHERE hour::date = '2012-11-28'::date) AS start_price1,
(SELECT AVG(price) FROM bitcoin.price.ez_hourly_token_prices WHERE hour::date = '2012-11-28'::date + INTERVAL '1 year') AS end_price1,
(SELECT AVG(price) FROM bitcoin.price.ez_hourly_token_prices WHERE hour::date = '2016-07-9'::date) AS start_price2,
(SELECT AVG(price) FROM bitcoin.price.ez_hourly_token_prices WHERE hour::date = '2016-07-9'::date + INTERVAL '1 year') AS end_price2,
(SELECT AVG(price) FROM bitcoin.price.ez_hourly_token_prices WHERE hour::date = '2020-05-11'::date) AS start_price3,
(SELECT AVG(price) FROM bitcoin.price.ez_hourly_token_prices WHERE hour::date = '2020-05-11'::date + INTERVAL '1 year') AS end_price3,
(SELECT AVG(price) FROM bitcoin.price.ez_hourly_token_prices WHERE hour::date = '2024-04-19'::date) AS start_price4,
(SELECT AVG(price) FROM bitcoin.price.ez_hourly_token_prices WHERE hour::date = CURRENT_DATE) AS end_price4
) AS Prices;
QueryRunArchived: QueryRun has been archived