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
Python for Engagement Data
00:00
5 left

Python for Engagement Data

MediumSQL · PostgreSQL

Problem

How would you extract and manipulate user engagement datasets using Python and standard data analysis libraries?

For this SQL exercise, use the provided user and engagement-event tables. Return users with engagement activity on at least two distinct days during January 2025.

Output

  1. One row per qualifying user with country, user_id, user_name, engagement_days, total_events, total_watch_seconds, and engagement_rank.
  2. Rank users within each country by total events, then watch time, with ties sharing a rank.
  3. Order by country, engagement_rank, and user_id.

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
user_nameVARCHAR(100)Display name of the user
countryVARCHAR(50)User country
signup_dateDATEDate the user registered
engagement_events
ColumnTypeDescription
event_idPKINTUnique engagement event identifier
user_idINTUser associated with the event
event_dateDATECalendar date of the event
event_typeVARCHAR(40)Type of engagement event
watch_secondsINTNumber of content-watch seconds recorded
Tablesusersengagement_events
Interviewer

Your question is Python for Engagement Data. Start with the requirements and the two 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.