community_updates has one row per post (user_id, post_date). For each user, compute the average number of days between consecutive posts (posts ordered by post_date; two posts on the same day give a gap of 0). Users with fewer than two posts have no gap and must be excluded. Output columns: user_id, avg_days (rounded to 2 decimals). Order by user_id ascending.
| Column | Type |
|---|---|
| user_id | INTEGER |
| post_date | DATE |
| user_id | post_date |
|---|---|
| 1 | 2026-01-01 |
| 1 | 2026-01-05 |
| 1 | 2026-01-11 |
| 2 | 2026-02-01 |
| 2 | 2026-02-08 |
| 3 | 2026-03-01 |
| user_id | avg_days |
|---|---|
| 1 | 5 |
| 2 | 7 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Desktop Versus Handheld Sessions · High-Volume Collaboration Members ›
{{ 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.