Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Top Shared Lenses by Region
00:00
5 left

Top Shared Lenses by Region

MediumSQL · PostgreSQL

Problem

Snapchat wants to identify the most frequently shared Lenses in each user region during the most recent completed seven-day reporting period. Write a SQL query to calculate Lens share counts by region and return the top three Lenses for every region.

Output

  1. One row per qualifying region and Lens, with columns region, lens_id, lens_name, and share_count.
  2. Include shares from September 8, 2026 through September 14, 2026, excluding September 15, 2026 and excluding rows whose user region is NULL.
  3. Return up to three Lenses per region, ordered by descending share_count, with ascending lens_id as the deterministic tie-breaker.
  4. Order the final results by region, descending share_count, and ascending lens_id.

Schema

users
ColumnTypeDescription
user_idPKINTUnique Snapchat user identifier
regionVARCHAR(50)Geographic region associated with the user
lenses
ColumnTypeDescription
lens_idPKINTUnique Snapchat Lens identifier
lens_nameVARCHAR(100)Display name of the Lens
lens_shares
ColumnTypeDescription
share_idPKINTUnique Lens share event identifier
user_idINTUser who shared the Lens
lens_idINTLens that was shared
shared_atDATEDate on which the Lens was shared
Tableslens_sharesuserslenses
Interviewer

Your question is Top Shared Lenses by Region. Start with the requirements and the three tables in the Question tab.

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.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.