Write SQL for basic user metrics

Quick Overview

This question evaluates proficiency in SQL for relational databases, specifically testing aggregation, joins, date/time grouping, and handling tied results when computing user metrics such as total users, peak signup month, and top-followed users.

Write SQL for basic user metrics

Company: Nextdoor

Role: Data Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

You are given a simplified schema for a fictional social app called **Nextagram**: - **users**(user_id PK, username, created_at TIMESTAMP) - **follows**(follower_user_id, followed_user_id, created_at TIMESTAMP) - each row means `follower_user_id` follows `followed_user_id` Assume `created_at` is a timestamp (timezone handling is ignored for this part). Write SQL queries to answer: 1) How many users are there? 2) In which **month** did the most users join? (Return the month and the count.) 3) What is the username of the user with the **most followers**? (If there is a tie, return all tied users.)

Quick Answer: This question evaluates proficiency in SQL for relational databases, specifically testing aggregation, joins, date/time grouping, and handling tied results when computing user metrics such as total users, peak signup month, and top-followed users.

|Home/Coding & Algorithms/Nextdoor
Nextdoor logo
Nextdoor
Feb 8, 2026, 12:00 AM
hardData EngineerTechnical ScreenCoding & Algorithms
5
0

You are given a simplified schema for a fictional social app called Nextagram:

  • users (user_id PK, username, created_at TIMESTAMP)
  • follows (follower_user_id, followed_user_id, created_at TIMESTAMP)
    • each row means follower_user_id follows followed_user_id

Assume created_at is a timestamp (timezone handling is ignored for this part).

Write SQL queries to answer:

  1. How many users are there?
  2. In which month did the most users join? (Return the month and the count.)
  3. What is the username of the user with the most followers ? (If there is a tie, return all tied users.)

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...