Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Handling Missing Values in Datasets
00:00
5 left

Handling Missing Values in Datasets

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.

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 Handling Missing Values in Datasets. 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.