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
SQL and Incremental Loading
00:00
5 left

SQL and Incremental Loading

MediumSQL · PostgreSQL

Problem

Tell me about your experience with SQL, database concepts, and incremental loading for keeping datasets up to date.

Demonstrate the incremental load using the provided PostgreSQL tables. Apply only records newer than the active watermark, insert new records, update existing records, and leave older records unchanged.

Output

  1. Return one row per record applied, with transaction_id, status, amount, and updated_at.
  2. Sort by transaction_id ascending.

Schema

source_transactions
ColumnTypeDescription
transaction_idPKINTSource transaction identifier
statusVARCHAR(20)Current transaction status
amountNUMERIC(12,2)Transaction amount
currencyVARCHAR(3)ISO currency code
updated_atTIMESTAMPTimestamp of the latest source change
phonepe_transactions
ColumnTypeDescription
transaction_idPKINTTarget transaction identifier
statusVARCHAR(20)Stored transaction status
amountNUMERIC(12,2)Stored transaction amount
currencyVARCHAR(3)Stored ISO currency code
updated_atTIMESTAMPTimestamp represented in the target
load_state
ColumnTypeDescription
load_state_idPKINTLoad state identifier
pipeline_nameVARCHAR(100)Name of the incremental pipeline
last_loaded_atTIMESTAMPLatest successfully processed source timestamp
is_activeBOOLEANWhether this watermark is currently active
Tablessource_transactionsphonepe_transactionsload_state
Interviewer

Your question is SQL and Incremental Loading. 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.