The creator_posts table has one row per post (tweet_id, user_id, tweet_date). Considering only posts dated in calendar year 2022, count how many posts each user published, then build a histogram: for every per-user post count (tweet_bucket), return how many users (users_num) published exactly that many posts. Users with no 2022 posts are not part of any bucket. Output columns: tweet_bucket, users_num. Order by tweet_bucket ascending.
| Column | Type |
|---|---|
| tweet_id | INTEGER |
| user_id | INTEGER |
| tweet_date | DATE |
| tweet_id | user_id | tweet_date |
|---|---|---|
| 101 | 1 | 2022-01-10 |
| 102 | 1 | 2022-02-15 |
| 103 | 2 | 2022-03-20 |
| 104 | 3 | 2022-04-11 |
| 105 | 3 | 2022-05-12 |
| 106 | 3 | 2022-06-13 |
| tweet_bucket | users_num |
|---|---|
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.