How do you handle data integrity when migrating records between environments?
Using the supplied source_records and target_records tables, write a SQL query that identifies records requiring investigation after a migration. Compare the identifying and data attributes, and distinguish missing, extra, and changed records.
source_record_id, target_record_id, integrity_status, source_name, target_name, source_status, target_status.| Column | Type | Description |
|---|---|---|
| record_idPK | INTEGER | Identifier of the source record |
| nhs_number | VARCHAR(10) | Illustrative NHS number value |
| full_name | VARCHAR(100) | Name stored in the source environment |
| postcode | VARCHAR(10) | Postcode stored in the source environment |
| active | BOOLEAN | Whether the source record is active |
| Column | Type | Description |
|---|---|---|
| target_record_idPK | INTEGER | Identifier assigned in the target environment |
| source_record_id | INTEGER | Source identifier associated with the migrated record |
| nhs_number | VARCHAR(10) | Illustrative NHS number value in the target |
| full_name | VARCHAR(100) | Name stored in the target environment |
| postcode | VARCHAR(10) | Postcode stored in the target environment |
| active | BOOLEAN | Whether the target record is active |