PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Nextdoor

Write SQL for app metrics

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in SQL-based data engineering, focusing on time-zone-aware timestamp handling, aggregation of event and relationship data, cohort retention analysis, and computation of product metrics like DAU, new users, photo activity, and follower distributions.

  • hard
  • Nextdoor
  • Coding & Algorithms
  • Data Engineer

Write SQL for app metrics

Company: Nextdoor

Role: Data Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

You are given a simplified schema for a photo-sharing app: - `users(user_id, user_name, joined_at)` - `photos(photo_id, user_id, created_at)` - `follows(follower_user_id, followed_user_id, created_at)` - `user_events(event_id, user_id, event_type, occurred_at)` Assume all timestamps are stored in UTC. Unless otherwise stated, reporting should use the `America/Los_Angeles` timezone. A row in `follows` represents a follow created at `created_at` and still active afterward. `DAU` means the number of distinct users with at least one row in `user_events` on that local calendar day. Also assume the dashboard is backed by these aggregate tables: - `kpi_daily_base(report_date, new_users, total_users_eod, dau, new_photos, total_follow_edges_eod)` - `follower_bucket_daily(report_date, bucket, user_count)` where `bucket` is one of `0`, `1_2`, or `3_plus` - `retention_cohort_daily(cohort_date, cohort_size, retained_w1_users)` Write SQL for the following tasks: 1. Count the total number of users. 2. Find the calendar month with the highest number of new user signups. 3. Find the user with the largest follower count. 4. Populate the daily aggregate tables from the raw tables so the dashboard can report: - new users - change versus 7 days earlier - DAU - change versus 7 days earlier - new photos - new photos per DAU - change versus 7 days earlier - total follower relationships - percentage of users with 0 followers - percentage of users with 1-2 followers - percentage of users with 3+ followers 5. Extend the SQL to compute week-1 retention, defined as: among users who signed up on day `D`, the share who had at least one event on days `D+7` through `D+13` in the reporting timezone.

Quick Answer: This question evaluates proficiency in SQL-based data engineering, focusing on time-zone-aware timestamp handling, aggregation of event and relationship data, cohort retention analysis, and computation of product metrics like DAU, new users, photo activity, and follower distributions.

Related Interview Questions

  • Build Ranked Feed With Photo Batching - Nextdoor (medium)
  • Merge Weekly Time Intervals - Nextdoor (medium)
  • Merge overlapping weekly time intervals - Nextdoor (medium)
  • Write SQL for basic user metrics - Nextdoor (hard)
  • Flatten Nested Comments - Nextdoor (easy)
Nextdoor logo
Nextdoor
Mar 1, 2026, 12:00 AM
Data Engineer
Technical Screen
Coding & Algorithms
3
0

You are given a simplified schema for a photo-sharing app:

  • users(user_id, user_name, joined_at)
  • photos(photo_id, user_id, created_at)
  • follows(follower_user_id, followed_user_id, created_at)
  • user_events(event_id, user_id, event_type, occurred_at)

Assume all timestamps are stored in UTC. Unless otherwise stated, reporting should use the America/Los_Angeles timezone. A row in follows represents a follow created at created_at and still active afterward. DAU means the number of distinct users with at least one row in user_events on that local calendar day.

Also assume the dashboard is backed by these aggregate tables:

  • kpi_daily_base(report_date, new_users, total_users_eod, dau, new_photos, total_follow_edges_eod)
  • follower_bucket_daily(report_date, bucket, user_count) where bucket is one of 0 , 1_2 , or 3_plus
  • retention_cohort_daily(cohort_date, cohort_size, retained_w1_users)

Write SQL for the following tasks:

  1. Count the total number of users.
  2. Find the calendar month with the highest number of new user signups.
  3. Find the user with the largest follower count.
  4. Populate the daily aggregate tables from the raw tables so the dashboard can report:
    • new users
    • change versus 7 days earlier
    • DAU
    • change versus 7 days earlier
    • new photos
    • new photos per DAU
    • change versus 7 days earlier
    • total follower relationships
    • percentage of users with 0 followers
    • percentage of users with 1-2 followers
    • percentage of users with 3+ followers
  5. Extend the SQL to compute week-1 retention, defined as: among users who signed up on day D , the share who had at least one event on days D+7 through D+13 in the reporting timezone.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Nextdoor•More Data Engineer•Nextdoor Data Engineer•Nextdoor Coding & Algorithms•Data Engineer Coding & Algorithms
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.