PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Data Manipulation (SQL/Python)/Meta

Find posts with >60s unconnected viewing time

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's proficiency in data manipulation and aggregation using SQL (or Python) to compute time-windowed metrics from event data, including filtering by boolean flags and summing durations per post.

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

Find posts with >60s unconnected viewing time

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

## Context You work on a social app where users can view posts. A view can be from a **connected** user (viewer is friends/connected with the post author) or **unconnected** (not connected). ## Tables Assume the following schema (UTC timestamps): ### `post_views` - `view_id` STRING (PK) - `post_id` STRING - `viewer_id` STRING - `view_ts` TIMESTAMP (UTC) - `view_duration_seconds` INT - `is_connected` BOOLEAN - `TRUE` if the viewer is connected to the post’s author at the time of view ## Task Write a SQL query to find posts whose **total unconnected view time** in the **last 7 days** is **greater than 60 seconds**. ### Requirements - Time window: `[current_timestamp - 7 days, current_timestamp)` in UTC. - Only include unconnected views: `is_connected = FALSE`. - Aggregate per `post_id`. ### Output Return: - `post_id` - `unconnected_view_seconds_7d` (sum of `view_duration_seconds` over the window) Order by `unconnected_view_seconds_7d` descending.

Quick Answer: This question evaluates a candidate's proficiency in data manipulation and aggregation using SQL (or Python) to compute time-windowed metrics from event data, including filtering by boolean flags and summing durations per post.

Related Interview 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)
Meta logo
Meta
Jul 28, 2025, 12:00 AM
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
2
0

Context

You work on a social app where users can view posts. A view can be from a connected user (viewer is friends/connected with the post author) or unconnected (not connected).

Tables

Assume the following schema (UTC timestamps):

post_views

  • view_id STRING (PK)
  • post_id STRING
  • viewer_id STRING
  • view_ts TIMESTAMP (UTC)
  • view_duration_seconds INT
  • is_connected BOOLEAN
    • TRUE if the viewer is connected to the post’s author at the time of view

Task

Write a SQL query to find posts whose total unconnected view time in the last 7 days is greater than 60 seconds.

Requirements

  • Time window: [current_timestamp - 7 days, current_timestamp) in UTC.
  • Only include unconnected views: is_connected = FALSE .
  • Aggregate per post_id .

Output

Return:

  • post_id
  • unconnected_view_seconds_7d (sum of view_duration_seconds over the window)

Order by unconnected_view_seconds_7d descending.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Data Manipulation (SQL/Python)•More Meta•More Data Scientist•Meta Data Scientist•Meta Data Manipulation (SQL/Python)•Data Scientist Data Manipulation (SQL/Python)
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.