PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Data Manipulation (SQL/Python)/Meta

Analyze Multiple-Account Users in SQL

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a data scientist's ability to perform SQL-level user- and account-level aggregation, grouping, and NULL-aware filtering to compute counts and proportions across related tables in the Data Manipulation (SQL/Python) domain.

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

Analyze Multiple-Account Users in SQL

Company: Meta

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Technical Screen

You are analyzing a product in which a single user can own multiple accounts. Use the following tables: **accounts** - `account_id` BIGINT — unique account ID - `user_id` BIGINT — owner of the account - `created_at` TIMESTAMP — when the account was created - `last_visit_at` TIMESTAMP — most recent time the user visited that account **notifications** - `notification_id` BIGINT — unique notification ID - `account_id` BIGINT — account that received the notification - `sent_at` TIMESTAMP — when the notification was sent - `read_at` TIMESTAMP NULL — when the notification was read; `NULL` means unread Assumptions: - Each account belongs to exactly one user. - A user may have one or more accounts. - All timestamps are stored in UTC. - For these questions, use the current state of the tables; no additional time window is required. Write SQL for the following: 1. Using only the `accounts` table, return the number of users who have exactly 2 accounts, exactly 3 accounts, and 4 or more accounts. - Required output columns: - `account_bucket` (`'2'`, `'3'`, or `'4+'`) - `user_count` 2. Among users who have 2 or more accounts, compute the percentage of users who have at least one unread notification across any of their accounts. - An unread notification is defined as `read_at IS NULL`. - Required output column: - `pct_multi_account_users_with_unread_notifications` as a decimal between 0 and 1.

Quick Answer: This question evaluates a data scientist's ability to perform SQL-level user- and account-level aggregation, grouping, and NULL-aware filtering to compute counts and proportions across related tables in the Data Manipulation (SQL/Python) domain.

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
Feb 9, 2026, 12:00 AM
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
0
0
Loading...

You are analyzing a product in which a single user can own multiple accounts.

Use the following tables:

accounts

  • account_id BIGINT — unique account ID
  • user_id BIGINT — owner of the account
  • created_at TIMESTAMP — when the account was created
  • last_visit_at TIMESTAMP — most recent time the user visited that account

notifications

  • notification_id BIGINT — unique notification ID
  • account_id BIGINT — account that received the notification
  • sent_at TIMESTAMP — when the notification was sent
  • read_at TIMESTAMP NULL — when the notification was read; NULL means unread

Assumptions:

  • Each account belongs to exactly one user.
  • A user may have one or more accounts.
  • All timestamps are stored in UTC.
  • For these questions, use the current state of the tables; no additional time window is required.

Write SQL for the following:

  1. Using only the accounts table, return the number of users who have exactly 2 accounts, exactly 3 accounts, and 4 or more accounts.
    • Required output columns:
      • account_bucket ( '2' , '3' , or '4+' )
      • user_count
  2. Among users who have 2 or more accounts, compute the percentage of users who have at least one unread notification across any of their accounts.
    • An unread notification is defined as read_at IS NULL .
    • Required output column:
      • pct_multi_account_users_with_unread_notifications as a decimal between 0 and 1.

Comments (0)

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 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.