Instagram Users with Over Ten Sessions on Three or More Days

Last updated: November 29, 2026

Quick Overview

From a daily Instagram sessions table, find the users who had more than ten sessions on at least three different days in the past week, along with their number of such days and their average sessions on those days.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Online Assessment
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


From a daily Instagram sessions table, find the users who had more than ten sessions on at least three different days in the past week, along with their number of such days and their average sessions on those days.

A GROUP BY and HAVING question in the style of Meta's online assessments for analytics roles. The interviewer checks that you can aggregate in two steps (per user-day, then per user) and filter at the right level.

What the Interviewer Expects
  • Aggregates sessions per user and day first
  • Filters heavy days with HAVING
  • Aggregates again per user and filters to three or more days
  • Returns readable columns with a clear order
  • Notes possible bot or logging causes for extreme counts
Key Topics to Cover
GROUP BY
HAVING
two-step aggregation
heavy users
Instagram
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you exclude accounts flagged as automated?
  • How would you find the top 1% of users by sessions instead of a fixed threshold?
  • What could cause many short sessions on Android in particular?
  • How would you write this without a subquery?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

ig_sessions(user_id, session_id, ds) with one row per session and ds the local date. Past week means the 7 days before today. A heavy day has more than 10 sessions....

Approach

First CTE: sessions per (user, day), keeping only days over 10 with HAVING. Second step: group those rows by user, keep users with at least three heavy days, and compute the average sessions on heav...


Submit Your Answer
Markdown supported