PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in SQL-based data manipulation and analytics, focusing on time-window filtering, grouping and aggregation (distinct counts and averages), and combining view and reaction event tables.

  • Medium
  • Meta
  • Data Manipulation (SQL/Python)
  • Data Scientist

Calculate Recent Post Views and Reactions for Social Media

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

info_stream_views +---------+-----------+--------------+----------+------------+ | post_id | viewer_id | relationship | duration | ds | +---------+-----------+--------------+----------+------------+ | 101 | 2001 | Friend | 45.7 | 2023-10-01 | | 102 | 2002 | Unconnected | 67.2 | 2023-10-01 | | 103 | 2003 | Followee | 12.0 | 2023-10-02 | | 104 | 2004 | Unconnected | 80.5 | 2023-10-02 | | 105 | 2005 | Friend | 30.0 | 2023-10-03 | +---------+-----------+--------------+----------+------------+ ​ post_reactions +---------+-----------+-------------+------------+ | post_id | viewer_id | post_action | ds | +---------+-----------+-------------+------------+ | 101 | 2001 | like | 2023-10-01 | | 101 | 2002 | comment | 2023-10-01 | | 102 | 2003 | reshare | 2023-10-02 | | 103 | 2001 | like | 2023-10-02 | | 104 | 2004 | like | 2023-10-03 | +---------+-----------+-------------+------------+ ##### Scenario Info stream engagement analytics for a social media platform; need recent metrics about post views and reactions. ##### Question Write a SQL query to find the number of distinct posts that accumulated at least one view longer than 60 seconds from viewers whose relationship to the author is 'Unconnected' during the last 7 days (relative to today). Write a SQL query to compute the average number of reactions (like, comment, reshare) per post separately for 'Friend' viewers and 'Unconnected' viewers over the last 7 days. ##### Hints Filter last 7 days, use relationship filter, group/aggregate by post and relationship.

Quick Answer: This question evaluates proficiency in SQL-based data manipulation and analytics, focusing on time-window filtering, grouping and aggregation (distinct counts and averages), and combining view and reaction event tables.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Compute ad impression conversion rates - Meta (medium)
  • Count unconnected posts and reactions - Meta (medium)
  • Count heavy callers in 7 days - Meta (medium)
  • Write SQL for call metrics - Meta (medium)
  • Write SQL for multi-account metrics - Meta (medium)