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
Handle Inconsistent Formatting Across Sources
00:00
5 left

Handle Inconsistent Formatting Across Sources

MediumSQL · PostgreSQL

Problem

How would you analyze a dataset with inconsistent formatting across multiple sources?

Using the source_records table, write a query that standardizes customer names, region values, and amount text while excluding records without a customer name. Preserve valid negative, zero, and missing amount values.

Output

  1. One row per retained source record, ordered by record_id ascending.
  2. Return record_id, source_system, customer_name, region, and amount using those exact names.
  3. Standardized names should use title case, regions should use uppercase, and amounts should be numeric or NULL.

Schema

source_records
ColumnTypeDescription
record_idPKINTUnique source record identifier
source_systemVARCHAR(30)System that supplied the record
raw_customer_nameVARCHAR(100)Customer name as received from the source
raw_regionVARCHAR(50)Region value as received from the source
raw_amountVARCHAR(40)Amount containing inconsistent currency formatting
Tablessource_records
Interviewer

Your question is Handle Inconsistent Formatting Across Sources. Start with the requirements and the one table 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.