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
Incremental Load SQL Query
00:00
5 left

Incremental Load SQL Query

MediumSQL · PostgreSQL

Problem

Write a SQL query to handle incremental data loads from a source table.

Use finacle_source_accounts as the source and finacle_account_snapshot as the target. Load records newer than the target's latest loaded timestamp, retain only the newest source version per account, and insert or update the target.

Output

  1. Return account_id, customer_name, status, balance, and source_updated_at for rows loaded or updated.
  2. Sort by account_id ascending.

Schema

finacle_source_accounts
ColumnTypeDescription
source_row_idPKINTUnique source extract row identifier
account_idINTFinacle account identifier
customer_nameVARCHAR(100)Account holder name
statusVARCHAR(20)Account status from the source
balanceNUMERIC(12,2)Account balance
source_updated_atTIMESTAMPSource system modification timestamp
finacle_account_snapshot
ColumnTypeDescription
account_idPKINTFinacle account identifier
customer_nameVARCHAR(100)Account holder name
statusVARCHAR(20)Latest loaded account status
balanceNUMERIC(12,2)Latest loaded account balance
source_updated_atTIMESTAMPLatest source timestamp loaded
Tablesfinacle_source_accountsfinacle_account_snapshot
Interviewer

Your question is Incremental Load SQL Query. 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.