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

Handling Missing Values

MediumSQL · PostgreSQL

Problem

You are given a dataset with missing values; how do you proceed?

Write a SQL query that profiles missing values in NHS activity records by site. Include sites with no activity records and treat missing site names as Unnamed site.

Output

  1. One row per NHS site.
  2. Columns: site_code, site_name, total_records, missing counts for each activity field, missing_value_count, and missing_value_rate_pct.
  3. Include sites with zero activity records, and order by site_code ascending.

Schema

nhs_sites
ColumnTypeDescription
site_idPKINTEGERUnique NHS site identifier
site_codeVARCHAR(20)Short NHS site code
site_nameVARCHAR(100)Display name of the NHS site
nhs_activity
ColumnTypeDescription
activity_idPKINTEGERUnique activity record identifier
site_idINTEGERNHS site associated with the activity
activity_dateDATEDate of the recorded activity
completed_attendancesINTEGERNumber of completed attendances
cancellationsINTEGERNumber of cancellations
postcodeVARCHAR(30)Postcode associated with the activity
Tablesnhs_sitesnhs_activity
Interviewer

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