cswork / libraryOpen practice workspace

Interview questions · Nextdoor

Write SQL for basic user metrics

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.

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

Community answers

Nothing here yet.

Join in on CSWork →