PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches

Quick Overview

This question evaluates a candidate's ability to compute time-based acceptance metrics, reason about data quality and abuse signals, and apply joins and filters in SQL/Python while accounting for nulls and incomplete user records.

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

Monitor Friend-Request System for Quality and Abuse

Company: Snapchat

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

Friendship +--------------+-------------+---------------------+---------------------+ | requester_id | approver_id | request_ts | approval_ts | +--------------+-------------+---------------------+---------------------+ | 1 | 2 | 2023-10-01 10:00:00 | 2023-10-01 12:00:00 | | 3 | 4 | 2023-10-01 11:00:00 | NULL | | 5 | 6 | 2023-10-02 09:00:00 | 2023-10-02 09:05:00 | | 7 | 8 | 2023-10-02 14:00:00 | 2023-10-05 10:00:00 | +--------------+-------------+---------------------+---------------------+ ​ Users +---------+---------+ | user_id | is_spam | +---------+---------+ | 1 | F | | 2 | F | | 3 | T | | 4 | F | | 5 | F | +---------+---------+ ##### Scenario Friend-request system wants to monitor quality and abuse for the past week using Friendship and Users tables. ##### Question Q1. Write an SQL query that returns each of the last 7 calendar days together with the same-day acceptance rate (approvals that occurred on the same date as the request divided by total requests that day). Q2. Write an SQL query that yields the percentage of friendship requests last week that did NOT originate from accounts marked spam = 'T'. Q3. The Users table may be incomplete (new users not yet present). Propose at least one data or query change to make Q1-Q2 robust, and list the key hypotheses and edge cases you would validate when interpreting the results. ##### Hints Think DATE(request_ts)=DATE(approval_ts); left joins to Users; NULL handling, late approvals, missing rows, timezone cut-offs.

Quick Answer: This question evaluates a candidate's ability to compute time-based acceptance metrics, reason about data quality and abuse signals, and apply joins and filters in SQL/Python while accounting for nulls and incomplete user records.

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 same-day acceptance metrics last week - Snapchat (Medium)
  • Compute CTR and metrics with pandas - Snapchat (Medium)
  • Compute User Retention and Analyze Event Data - Snapchat (Medium)
  • Compute User Group Stories and Aggregate Story Engagement - Snapchat (Medium)