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
Root-Cause Analysis Of Settlement Breaks
00:00
5 left

Root-Cause Analysis Of Settlement Breaks

MediumSQL · PostgreSQL

Problem

Describe how you would approach a settlement information sheet and a multi-tab Excel workbook to identify where settlement breaks occurred and draft a clear summary of the root causes.

Use the settlement sheet, workbook check results, and root-cause reference data provided below. Return only breaks recorded on the settlement sheet, including breaks without a mapped workbook cause.

Output

  1. One row per root-cause category, with root_cause, break_count, total_expected_amount, variance_amount, and settlement_ids.
  2. Treat a missing actual amount as the full expected amount of variance.
  3. Sort by break_count descending, then root_cause ascending.

Output details

  • Select only rows whose sheet_status equals Break.
  • Use Unclassified for breaks without a mapped root cause.
  • Calculate non-null variance as the absolute difference between actual and expected amounts.
  • Sum expected amounts and variances for every contributing matched record without deduplicating settlement IDs.
  • List settlement_ids in ascending order, separated by , , retaining repeated IDs.

Schema

settlement_sheet
ColumnTypeDescription
settlement_idPKINTUnique settlement identifier
trade_idVARCHAR(20)Trade identifier
settlement_dateDATEScheduled settlement date
expected_amountNUMERIC(14,2)Expected settlement amount
actual_amountNUMERIC(14,2)Amount actually settled
sheet_statusVARCHAR(20)Settlement sheet status
counterpartyVARCHAR(40)Trading counterparty
workbook_checks
ColumnTypeDescription
check_idPKINTUnique workbook check identifier
settlement_idINTSettlement reviewed by the workbook tab
tab_nameVARCHAR(40)Workbook tab containing the check
workbook_statusVARCHAR(20)Workbook check result
issue_codeVARCHAR(30)Reference code for the identified issue
notesTEXTAnalyst notes from the workbook
issue_codes
ColumnTypeDescription
issue_codePKVARCHAR(30)Issue classification code
root_causeVARCHAR(60)Readable root-cause category
severityVARCHAR(20)Issue severity
Tablessettlement_sheetworkbook_checksissue_codes
Interviewer

Your question is Root-Cause Analysis Of Settlement Breaks. 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.