Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
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
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
Transform Sample Data
00:00
5 left

Transform Sample Data

MediumSQL · PostgreSQL

Problem

From this sample data, perform the necessary transformation to achieve a desirable end state.

Use raw_kyc_events and source_systems. Return the latest valid event for each subject, normalize its status, classify its risk score, and retain subjects whose source reference has no matching source record.

Output

  1. One row per non-null subject reference.
  2. Columns: subject_ref, source_name, observed_at, normalized_status, risk_tier, and risk_score.
  3. Use Unknown source for unmatched or null sources and unclassified for null or unrecognized statuses.
  4. Order by subject_ref ascending.

Schema

raw_kyc_events
ColumnTypeDescription
event_idPKINTUnique event identifier
subject_refVARCHAR(30)External subject reference
source_idINTReference to the originating source system
observed_atTIMESTAMPTime when the event was observed
raw_statusVARCHAR(30)Unnormalized source status
risk_scoreNUMERIC(5,2)Numeric risk score
source_systems
ColumnTypeDescription
source_idPKINTUnique source system identifier
source_nameVARCHAR(80)Display name of the source system
Tablesraw_kyc_eventssource_systems
Interviewer

Your question is Transform Sample Data. 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.