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
Normalize Messy CRM Contact Data
00:00
5 left

Normalize Messy CRM Contact Data

HardSQL · PostgreSQL

Problem

You are given a messy CRM with inconsistent data entry standards across contacts, accounts, and activity logs. Write a PostgreSQL query that returns one row per contact with standardized fields, a data quality status, and the most recent activity date. Treat blank strings as missing values, normalize email addresses to lowercase, and classify each contact as valid, needs_review, or invalid based on the available data.

Schema

contacts
ColumnTypeDescription
contact_idPKINTPrimary key for the contact
account_idINTForeign key to the related account
full_nameVARCHAR(255)Raw contact name entered in the CRM
emailVARCHAR(255)Raw email address with inconsistent casing or blanks
phoneVARCHAR(50)Raw phone number with inconsistent formatting
statusVARCHAR(50)User-entered CRM status
accounts
ColumnTypeDescription
account_idPKINTPrimary key for the account
account_nameVARCHAR(255)Account name
owner_teamVARCHAR(100)Owning team for the account
activities
ColumnTypeDescription
activity_idPKINTPrimary key for the activity
contact_idINTForeign key to the related contact
activity_dateDATEDate when the activity occurred
activity_typeVARCHAR(50)Type of activity logged
Tablescontactsaccountsactivities
Interviewer

Your question is Normalize Messy CRM Contact 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.