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
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
Handling Missing Values in Joins
00:00
5 left

Handling Missing Values in Joins

HardSQL · PostgreSQL

Problem

Describe your approach to handling missing values or data quality issues when joining disparate datasets at scale for commodity data.

For this hands-on SQL assessment, write a query that preserves every source observation, standardizes available commodity and market values, and assigns one data-quality status based on the first applicable issue.

Output

  1. One row per source observation, ordered by observation_id ascending.
  2. Return observation_id, source_system, standardized_commodity, market_name, observation_date, price, currency, and quality_status.
  3. Use UNKNOWN for unmatched or blank commodity and market values. Statuses must identify missing dates, missing prices, non-positive prices, missing currencies, missing or unmatched commodity codes, missing or unmatched market codes, or VALID.

Schema

commodity_observations
ColumnTypeDescription
observation_idPKINTUnique source observation identifier
source_systemVARCHAR(30)System that supplied the observation
source_commodity_codeVARCHAR(20)Commodity code supplied by the source
source_market_codeVARCHAR(20)Market code supplied by the source
observation_dateDATEDate associated with the commodity observation
priceNUMERIC(12,2)Reported commodity price
currencyVARCHAR(3)Reported ISO currency code
commodity_code_map
ColumnTypeDescription
source_systemPKVARCHAR(30)Source system for the code
source_commodity_codePKVARCHAR(20)Source-specific commodity code
commodity_nameVARCHAR(80)Standardized commodity name
commodity_groupVARCHAR(40)Standardized commodity group
market_reference
ColumnTypeDescription
source_market_codePKVARCHAR(20)Canonical market code
market_nameVARCHAR(80)Standardized market name
regionVARCHAR(40)Market geographic region
Tablescommodity_observationscommodity_code_mapmarket_reference
Interviewer

Your question is Handling Missing Values in Joins. 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.