PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates a candidate's ability to perform data manipulation and aggregation using SQL (and optionally Python), focusing on counting unique users per shop by calendar date and handling date-based filtering.

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

Generate Daily Unique User Views for Each Shop

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

shop_views +---------+---------+---------------------+ | user_id | shop_id | view_time | +---------+---------+---------------------+ | 101 | 1 | 2023-05-01 10:00:00 | | 102 | 1 | 2023-05-01 11:12:00 | | 101 | 2 | 2023-05-02 09:35:00 | | 103 | 1 | 2023-05-02 14:00:00 | | 104 | 3 | 2023-05-02 15:32:00 | +---------+---------+---------------------+ ##### Scenario The commerce team wants a daily report of how many unique users saw each shop in the last 7 days. ##### Question Write SQL to return, for every shop_id and calendar date in the past 7 days, the number of unique users who viewed that shop. ##### Hints Use DATE_TRUNC or CAST to day, DISTINCT user_id, and filter on current_date-7.

Quick Answer: This question evaluates a candidate's ability to perform data manipulation and aggregation using SQL (and optionally Python), focusing on counting unique users per shop by calendar date and handling date-based filtering.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,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)