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
ExperiencesCoaching
New
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
Get started
Identifying and Fixing Data Errors
00:00
5 left

Identifying and Fixing Data Errors

MediumSQL · PostgreSQL

Problem

Given a dataset with errors, how would you identify and rectify them for PulsePoint?

Use the supplied ingestion records and campaign catalog. Normalize campaign codes, replace NULL or negative numeric values with zero, replace missing countries with UNKNOWN, and reject records with missing or unknown campaigns, missing dates, or duplicate event IDs after retaining the earliest ingestion record.

Output

  1. One row per ingestion record with corrected fields, status, and issue count.
  2. Order by ingestion_id ascending.

Schema

impression_events
ColumnTypeDescription
ingestion_idPKINTUnique ingestion row identifier
event_idVARCHAR(30)Event identifier that may appear more than once
campaign_codeVARCHAR(40)Raw campaign identifier
event_dateDATEDate on which the impression event occurred
impressionsINTNumber of impressions recorded
spendNUMERIC(10,2)Recorded advertising spend
country_codeVARCHAR(5)Two-letter country code
campaign_catalog
ColumnTypeDescription
campaign_codePKVARCHAR(40)Canonical campaign identifier
channelVARCHAR(30)Marketing channel
Tablesimpression_eventscampaign_catalog
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

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.