Tell me about how you handle missing or inconsistent data when building a logistics model for Deloitte's client projects.
Write a SQL query that audits shipment records against carrier reference data. Identify missing values, invalid carrier references, invalid statuses, date inconsistencies, and non-positive or incomplete weight values.
shipment_recordsshipment_id, client_reference, carrier_name, quality_status, issue_count, and issue_typesNeeds Review, and sort by shipment_id ascending| Column | Type | Description |
|---|---|---|
| shipment_idPK | INT | Unique shipment identifier |
| client_reference | VARCHAR(30) | Client-provided shipment reference |
| carrier_code | VARCHAR(10) | Carrier code recorded on the shipment |
| planned_delivery_date | DATE | Planned delivery date |
| actual_delivery_date | DATE | Recorded delivery date |
| status | VARCHAR(20) | Shipment lifecycle status |
| expected_weight_kg | DECIMAL(10,2) | Expected shipment weight in kilograms |
| actual_weight_kg | DECIMAL(10,2) | Measured shipment weight in kilograms |
| Column | Type | Description |
|---|---|---|
| carrier_codePK | VARCHAR(10) | Unique carrier code |
| carrier_name | VARCHAR(80) | Carrier display name |
| is_active | BOOLEAN | Whether the carrier is currently active |