Last active
October 20, 2023 19:41
-
-
Save veeve/486d0f2a15de5fcb8d6ef3960ced9f38 to your computer and use it in GitHub Desktop.
tweets-sql
This file contains hidden or 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 tweets as ( | |
select | |
t.user.name, | |
t.text, | |
upper(sym.text) as ticker | |
from | |
Demo.twitter_live as t, | |
unnest(t.entities.symbols) as sym | |
where | |
t.entities.symbols [1] is not null | |
and t.created_at > current_timestamp() - DAYS(1) | |
) | |
select | |
tw.ticker, | |
tkr.Name as CompanyName, | |
tkr.Industry, | |
count(*) as tweet_count | |
from | |
tweets as tw | |
join Demo.tickers_alias as tkr on tkr.Symbol = tw.ticker | |
group by | |
tw.ticker, | |
tkr.Name, | |
tkr.Industry | |
order by | |
count(*) desc | |
limit | |
10; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment