Last active
June 12, 2022 14:05
-
-
Save peacing/d578aa04e8fa1c85be3e795fa3ab56ad to your computer and use it in GitHub Desktop.
daily change of crypto prices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with yest AS ( | |
SELECT currency, price | |
FROM f_crypto_prices | |
WHERE TRUNC(datetime, 'day') = '20220315') | |
, today AS ( | |
SELECT currency, price | |
FROM f_crypto_prices | |
WHERE TRUNC(datetime, 'day') = '20220316') | |
SELECT | |
currency, | |
(today.price - yest.price) / yest.price * 100 AS pct_change | |
FROM yest, today | |
WHERE currency = 'BTC' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment