Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL: Top Engaged Save Interactors

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL: Top Engaged Save Interactors. Start with the requirements and the three tables on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Meta's Product Growth team is evaluating Instagram Save engagement across regions. Using quarterly interaction and engagement data, write a PostgreSQL query to find the top three users in each region who interacted with an Instagram Save feature during Q2 2025.

Requirements

  1. Filter instagram_save_interactions to completed Instagram Save interactions from 2025-04-01 through 2025-06-30, inclusive.
  2. Aggregate each qualifying user's engagement score and engagement event count during the same quarter. Users with no engagement events must remain eligible with a score of zero.
  3. Rank users independently within each non-null region by engagement score descending, breaking ties with user_id ascending, and return ranks 1 through 3.

Schema

users
ColumnTypeDescription
user_idPKINTUnique Meta user identifier
user_nameVARCHAR(100)User display name
regionVARCHAR(50)User's geographic region
instagram_save_interactions
ColumnTypeDescription
interaction_idPKINTUnique Save interaction identifier
user_idINTUser who performed the interaction
feature_nameVARCHAR(100)Instagram feature involved in the interaction
interacted_atDATEDate of the interaction
engagement_events
ColumnTypeDescription
event_idPKINTUnique engagement event identifier
user_idINTUser associated with the event
event_dateDATEDate of the engagement event
engagement_scoreINTWeighted engagement score for the event
Tablesusersinstagram_save_interactionsengagement_events
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results