Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 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
Build my plan
SQL and Python Data Cleaning
00:00
5 left

SQL and Python Data Cleaning

HardSQL · PostgreSQL

Problem

Tell me about your experience using SQL commands and Python for data cleaning.

For the SQL portion, write a PostgreSQL query that standardizes names, emails, and phone numbers, removes invalid or unsupported email records, handles missing phone values, and keeps the most recently updated record for duplicate emails.

Output

  1. One row per accepted email record with record_id, cleaned_name, cleaned_email, cleaned_phone, and updated_at.
  2. Exclude invalid, missing, duplicate older, and unsupported-domain email records.
  3. Sort by cleaned_email, then record_id.

Schema

raw_customer_records
ColumnTypeDescription
record_idPKINTUnique raw record identifier
full_nameVARCHAR(150)Unstandardized person name
emailVARCHAR(255)Raw email address
phoneVARCHAR(40)Raw phone number
updated_atTIMESTAMPTimestamp of the source record update
email_domain_rules
ColumnTypeDescription
domainPKVARCHAR(120)Supported lowercase email domain
domain_labelVARCHAR(120)Readable domain description
Tablesraw_customer_recordsemail_domain_rules
Interviewer

Your question is SQL and Python Data Cleaning. 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.