Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Trending in AI
Hot
Agentic AI EngineerForward-Deployed EngineerGenAI EngineerAI Architect
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
Start free
Automating Data Cleaning with Python
00:00
5 left

Automating Data Cleaning with Python

HardSQL · PostgreSQL

Problem

Describe your experience using Python to automate data cleaning or processing tasks.

For this practical SQL exercise, demonstrate the same type of cleaning and processing logic with PostgreSQL. Standardize valid email addresses, retain the newest record for each email, map recognized statuses, and attach source system names when available.

Output

  1. One row per retained applicant, with columns normalized_email, full_name, status_label, source_name, and updated_at.
  2. Exclude blank, null, malformed, and unrecognized-status records.
  3. Retain only the newest record for each normalized email.
  4. Sort by normalized_email ascending, with updated_at descending as a tie-breaker.

Schema

raw_applications
ColumnTypeDescription
idPKINTUnique raw application record identifier
raw_emailVARCHAR(255)Applicant email as received from an input source
raw_nameVARCHAR(150)Applicant name as received from an input source
raw_statusVARCHAR(30)Unstandardized application status
source_system_idINTOptional reference to the originating source system
updated_atTIMESTAMPTimestamp when this application record was updated
source_systems
ColumnTypeDescription
source_system_idPKINTUnique source system identifier
source_nameVARCHAR(80)Readable source system name
Tablesraw_applicationssource_systems
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.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.