Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Track Conversion Defects by Batch

MediumSQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Track Conversion Defects by Batch. Start with the requirements and the four tables on the right.

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.

Problem

You are given source records, converted records, and defect logs from a data conversion process tracked in Accenture myWizard. Write a PostgreSQL query that returns one row per conversion batch for batches completed in March 2024. For each batch, show the total source records, successfully converted records, records with data mismatches, open defects, and a batch status of Resolved or Needs Attention. A batch should be Needs Attention if it has at least one open defect or at least one mismatched record; otherwise mark it Resolved.

Schema

conversion_batches
ColumnTypeDescription
batch_idPKINTPrimary key for the conversion batch
batch_nameVARCHAR(100)Human-readable batch name
completed_dateDATEDate the conversion batch was completed
source_records
ColumnTypeDescription
source_idPKINTPrimary key for the source record
batch_idINTBatch to which the source record belongs
source_amountNUMERIC(10,2)Amount in the source system
converted_records
ColumnTypeDescription
converted_idPKINTPrimary key for the converted record
source_idINTSource record that was converted
converted_amountNUMERIC(10,2)Amount after conversion
conversion_statusVARCHAR(20)Status of the conversion attempt
defect_log
ColumnTypeDescription
defect_idPKINTPrimary key for the defect
batch_idINTBatch associated with the defect
defect_typeVARCHAR(30)Type of defect found during validation
defect_statusVARCHAR(20)Current status of the defect
Tablesconversion_batchessource_recordsconverted_recordsdefect_log
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results