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
Handling Missing Longitudinal Data
00:00
5 left

Handling Missing Longitudinal Data

HardSQL · PostgreSQL

Problem

How do you handle missing or erroneous data points in a longitudinal research study?

For this SQL exercise, treat a missing point as a scheduled visit without a measurement. Treat a point as erroneous when its value is NULL, outside the range 0 to 100, or recorded before the scheduled visit.

Output

  1. Return one row per missing or erroneous scheduled visit.
  2. Include participant_id, participant_name, scheduled_visit_id, scheduled_date, issue_type, observed_value, and recorded_at.
  3. Sort by participant, scheduled date, and scheduled visit ID.

Schema

participants
ColumnTypeDescription
participant_idPKINTUnique study participant identifier
participant_nameVARCHAR(100)Participant display name
scheduled_visits
ColumnTypeDescription
scheduled_visit_idPKINTUnique scheduled visit identifier
participant_idINTParticipant expected at the visit
scheduled_dateDATEDate on which the measurement was expected
measurements
ColumnTypeDescription
measurement_idPKINTUnique measurement identifier
scheduled_visit_idINTScheduled visit associated with the measurement
measurement_valueNUMERIC(6,2)Observed study value expected to be between 0 and 100
recorded_atTIMESTAMPTimestamp when the measurement was recorded
Tablesparticipantsscheduled_visitsmeasurements
Interviewer

Your question is Handling Missing Longitudinal Data. 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.