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

Handling Missing Data

MediumSQL · PostgreSQL

Problem

How would you handle missing data before analysis and modeling?

For this SQL exercise, treat a missing score as either a NULL score or an absent score record. Replace missing scores with the median observed score for the same assessment type, while preserving complete records.

Output

  1. One row per assignment, ordered by assignment_id.
  2. Return assignment_id, learner_name, assessment_type, original_score, cleaned_score, and was_missing.
  3. was_missing must indicate whether the original score was missing.

Schema

learners
ColumnTypeDescription
learner_idPKINTUnique learner identifier
learner_nameVARCHAR(100)Learner's display name
assessment_assignments
ColumnTypeDescription
assignment_idPKINTUnique assessment assignment identifier
learner_idINTLearner assigned to the assessment
assessment_typeVARCHAR(30)Assessment category
assessment_scores
ColumnTypeDescription
score_idPKINTUnique score record identifier
assignment_idINTRelated assessment assignment
scoreNUMERIC(5,2)Observed assessment score from 0 to 100
Tableslearnersassessment_assignmentsassessment_scores
Interviewer

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