Query editor
-- comprehensive tweet frequency analysis with statistical predictionwith raw_data as (select json_parse(http_get('https://gist.githubusercontent.com/cipher-rc5/32fa6ef91cb6436b9a2b8b8eef400f06/raw/4b29f1e1367de8618d1e0ad96b11dac2951c4c82/elon_musk_tweets.json')) as response_data),parsed_tweets as (selectjson_extract_scalar(tweet, '$.tweet_id') as tweet_id, from_iso8601_timestamp(json_extract_scalar(tweet, '$.created_at_iso')) as created_at, json_extract_scalar(tweet, '$.text') as tweet_textfrom raw_datacross join unnest(cast(json_extract(response_data, '$.tweets') as array(json))) as t(tweet)where json_extract_scalar(tweet, '$.username') = 'elonmusk'),hourly_stats as (selecthour(created_at) as hour_of_day, count(*) as total_tweets, count(*) / cast(count(distinct date(created_at)) as double) as avg_tweets_per_hourfrom parsed_tweetsgroup by hour(created_at)),daily_stats as (selectdate(created_at) as day, count(*) as tweets_count, day_of_week(created_at) as day_of_weekfrom parsed_tweetsgroup by date(created_at), day_of_week(created_at)),daily_by_dow as (selectday_of_week, case day_of_weekwhen 1 then 'Monday'when 2 then 'Tuesday'when 3 then 'Wednesday'when 4 then 'Thursday'when 5 then 'Friday'when 6 then 'Saturday'when 7 then 'Sunday'end as day_name, avg(tweets_count) as avg_tweets, stddev(tweets_count) as stddev_tweets, min(tweets_count) as min_tweets, max(tweets_count) as max_tweetsfrom daily_statsgroup by day_of_week),weekly_stats as (selectdate_trunc('week', created_at) as week_start, count(*) as tweets_countfrom parsed_tweetsgroup by date_trunc('week', created_at)),recent_weeks as (selecttweets_count