Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 feedbackSuccess 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
Average Reels Watch Time with NULLs
00:00
5 left

Average Reels Watch Time with NULLs

EasySQL · PostgreSQL

Problem

A Meta Product Growth Analyst is reviewing Instagram Reels engagement as part of the AARRR funnel. Some time_spent_seconds values are NULL because the client failed to log watch time for a subset of sessions.

Write a SQL query to calculate the average time spent on Reels by surface, while handling NULL values correctly.

Requirements

  1. Return surface and the average of time_spent_seconds as avg_time_spent_seconds.
  2. Exclude NULL watch-time values from the average calculation.
  3. Only include rows where event_date is '2024-06-01'.
  4. Order the result by avg_time_spent_seconds in descending order.

Schema

reels_watch_events
ColumnTypeDescription
event_idPKINTUnique event identifier
user_idINTMeta user identifier
surfaceVARCHAR(50)Instagram Reels entry surface
time_spent_secondsINTTime spent watching Reels in seconds; NULL indicates missing logging
event_dateDATEDate of the watch event
Tablesreels_watch_events
Interviewer

Your question is Average Reels Watch Time with NULLs. Start with the requirements and the one table 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.