Foundations Track · Medium · 25 min
02 Medium Twitter Tweets Rolling Averages
-- tweets rolling average -- WITH tweet_posts AS ( SELECT user_id, tweet_date, COUNT(tweet_id) AS tweet_count FROM tweets GROUP BY user_id, tweet_date ) SELE...
Company labels are directional practice context, not official interview guidance.
Objective
Practice aggregation through a Twitter-tagged business scenario.
Approach
Use this track to lock in clean query structure, basic filtering logic, and confidence with grouped output.
Company context
Company labels are directional practice context, not official interview guidance.
-- tweets rolling average -- WITH tweet_posts AS ( SELECT user_id, tweet_date, COUNT(tweet_id) AS tweet_count FROM tweets GROUP BY user_id, tweet_date ) SELECT user_id, tweet_date, ROUND( AVG(tweet_count) OVER (PARTITION BY user_id ORDER BY tweet_date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), 2 ) AS rolling_avg_3days FROM tweet_posts;
This is a Pro question
Upgrade to Pro to unlock this prompt, the SQL workspace, and all 254 problems.
Upgrade to Pro — unlock all 254 problemsSQL workspace
Run queries against the protected question data, then submit once the result shape looks right.
Sign in to run SQL
Create a free account or sign in before running queries against protected question data.