Average Post Hiatus | Facebook SQL Interview Question
Given a table of Facebook posts, for each user who posted at least twice in 2021, write a query to find the number of days between each user’s first post of the year and last post of the year in the year 2021. Output the user and number of the days between each user's first and last post. p.s. If you've read the Ace the Data Science Interview and liked it, consider writing us a review? The dataset you are querying against may have different input & output - this is just an example! First, we can use the MIN() and MAX() aggregate functions on the post_date column to retrieve the earliest and latest post dates, and substract one from another accordingly. To calculate the difference for each user, we GROUP the results by user_id, and then filter for posts made in the year 2021. To do so, we use the DATE_PART() function to extract the year from the post_date column. In the final step, to exclude users who have posted only once during the year, we apply the HAVING clause with a COUNT() cond
Average Post Hiatus | Facebook SQL Interview Question Share Premium Back to questions Average Post Hiatus (Part 1) Facebook SQL Interview Question Average Post Hiatus (Part 1) Facebook SQL Interview Question Question Solution Discussion Submissions Given a table of Facebook posts, for each user who posted at least twice in 2021, write a query to find the number of days between each user’s first post of the year and last post of the year in the year 2021. Output the user and number of the days between each user's first and last post. p.s. If you've read the Ace the Data Science Interview and li
Explore this link on the map →saved by
related reading
- Roam Research – A note taking tool for networked thought.roamresearch.com
- SF Privately Owned Public Open Spacessfpopos.com
- Postiz: The All-in-One agentic social media scheduling toolpostiz.com
- old friends - starting from nixstartingfromnix.com
- PostHogus.posthog.com
- Check if user is authenticated for the first time in Firebase Google Authentication in Android - Stack Overflowstackoverflow.com
- Best time to post on social media in 2025 (by platform)blog.hootsuite.com
- database design - Calendar Recurring/Repeating Events - Best Storage Method - Stack Overflowstackoverflow.com
- Introducing Slow Social - DEV Communitydev.to
- Outerbase | The interface for your databaseouterbase.com
- Two Sizes Fit Most: PostgreSQL and ClickHouse - The New Stackthenewstack.io
- Do You Have Lightning In a Bottle? How to Benchmark Your Social App | Andreessen Horowitza16z.com