Explain your experience with database queries and how you ensure data integrity when merging disparate data sources at NYU Langone Health.
Write a SQL query that compares encounter records from the two provided sources and identifies unmatched records or conflicting values. Preserve records found in either source.
integrity_status.MATCHED, DISCREPANCY, MISSING_FROM_BILLING, or MISSING_FROM_EHR statuses.| Column | Type | Description |
|---|---|---|
| encounter_idPK | VARCHAR(20) | EHR encounter identifier |
| patient_id | VARCHAR(20) | Patient identifier shared across source systems |
| encounter_date | DATE | Date of the encounter |
| diagnosis_code | VARCHAR(10) | Primary diagnosis code recorded in the EHR |
| total_charge | NUMERIC(10,2) | Total charge recorded in the EHR |
| Column | Type | Description |
|---|---|---|
| encounter_idPK | VARCHAR(20) | Billing encounter identifier |
| patient_id | VARCHAR(20) | Patient identifier shared across source systems |
| encounter_date | DATE | Date of the billed encounter |
| diagnosis_code | VARCHAR(10) | Primary diagnosis code recorded for billing |
| total_charge | NUMERIC(10,2) | Total charge recorded by billing |