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
Start free
Identify January Loan Balance Reconciliation Issues
00:00
5 left

Identify January Loan Balance Reconciliation Issues

MediumSQL · PostgreSQL

Problem

How do you ensure data accuracy when working with complex financial datasets?

Using the supplied January 2025 loan snapshots and payment transactions, write a SQL query that identifies records where the reported ending balance does not reconcile with the opening balance and principal payments.

Output

  1. One row per reconciliation issue.
  2. Return loan_id, snapshot_date, reported_ending_balance, calculated_ending_balance, discrepancy_amount, and accuracy_status.
  3. Include missing reported balances and discrepancies greater than $0.01. Order by loan_id.

Output details

  • Include payment dates on or after 2025-01-01 and before 2025-02-01.
  • Sort by loan_id ascending.
  • Treat missing or NULL principal-payment totals as 0.00.
  • For NULL reported_ending_balance, return NULL discrepancy_amount and MISSING_REPORTED_BALANCE.

Schema

loan_snapshots
ColumnTypeDescription
loan_idPKVARCHAR(20)Unique loan identifier
snapshot_dateDATEDate of the reported loan balance
opening_balanceNUMERIC(14,2)Balance at the start of the reporting period
reported_ending_balanceNUMERIC(14,2)Balance reported at the end of the period
payment_transactions
ColumnTypeDescription
payment_idPKVARCHAR(20)Unique payment identifier
loan_idVARCHAR(20)Loan associated with the payment
payment_dateDATEDate the payment was posted
principal_paidNUMERIC(14,2)Principal component of the payment
Tablesloan_snapshotspayment_transactions
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.