AnalystPath

Tweet Frequency Histogram

SQLEasyJunior levelTwitter/X~15 min

Problem

**[Asked at Twitter/X]**

Analyze posting habits on the platform. Given a table of tweets posted in 2022,
build a frequency histogram: for each possible number of tweets a user could post,
report how many users posted exactly that many times.

For example, if 3 users posted exactly 1 tweet and 2 users posted exactly 5 tweets,
the result should include rows for both bucket 1 and bucket 5.

Tables

Example rows — the live problem includes the full dataset.

posts_2022
post_iduser_idbodyposted_at

Expected output

Your answer should return 3 rows with the columns tweet_count, user_count.

Starter code (SQL)

SELECT *
FROM posts_2022;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions