PracHub
QuestionsCoachesLearningGuidesInterview Prep

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.

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
  • AI Coding 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

  • Calculate Daily Survey Response Rates by Country - Meta (medium)
  • Compare Survey Satisfaction for New and Established Users - Meta (medium)
  • Find A Low-Quality Annotator From Label Data - Meta (hard)
  • Compute ad impression conversion rates - Meta (medium)
  • Count unconnected posts and reactions - Meta (medium)