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
Identify Unresolved Monthly Reconciliation Gaps
00:00
5 left

Identify Unresolved Monthly Reconciliation Gaps

MediumSQL · PostgreSQL

Problem

You have a monthly task to complete and notice that there are gaps in the reconciliation of the data. You are expected to report on the tasks within one week. Tell me what you would do in the period between discovering there was data missing and the task due date?

Using the supplied reconciliation tables, write a query that identifies unresolved gaps for the latest monthly task and provides the information needed for follow-up.

Output

  1. One row per unresolved reconciliation item, including missing and rejected submissions.
  2. Columns: task_id, month_start, item_id, policy_id, expected_amount, source_amount, submission_status, days_from_discovery_to_due, and prior_month_status.
  3. Order by policy_id, then item_id.

Output details

  • Treat the latest task as the one with the greatest month_start.
  • Use the most recently submitted status per item_id, ordering by submitted_at descending with nulls last, then submission_id descending.
  • Interpret rejected submissions as status exactly REJECTED; include items whose latest status is null.
  • Calculate source_amount as the sum of transaction amount by policy_id and month_start, leaving it null when no transactions exist.
  • Use the preceding month_start status for the same policy_id as prior_month_status.
  • Sort policy_id and then item_id in ascending order.

Schema

monthly_reconciliation_tasks
ColumnTypeDescription
task_idPKINTMonthly reconciliation task identifier
month_startDATEFirst day of the reconciliation month
discovered_atDATEDate the reconciliation issue was discovered
due_dateDATEReporting deadline
expected_reconciliation_items
ColumnTypeDescription
item_idPKINTExpected reconciliation item identifier
task_idINTRelated monthly task
policy_idVARCHAR(20)Policy identifier
expected_amountDECIMAL(12,2)Amount expected in the reconciliation
reconciliation_submissions
ColumnTypeDescription
submission_idPKINTSubmission attempt identifier
item_idINTRelated reconciliation item
submitted_atDATESubmission date
statusVARCHAR(20)Submission review status
source_transactions
ColumnTypeDescription
transaction_idPKINTSource transaction identifier
policy_idVARCHAR(20)Policy associated with the transaction
transaction_monthDATEFirst day of the transaction month
amountDECIMAL(12,2)Transaction amount
Tablesmonthly_reconciliation_tasksexpected_reconciliation_itemsreconciliation_submissionssource_transactions
Interviewer

Your question is Identify Unresolved Monthly Reconciliation Gaps. Start with the requirements and the four 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.