Write a query to perform string manipulation to extract specific substrings from a messy log table.
Use messy_logs and log_sources. Extract the policy number, claim ID, and event code when present, while retaining rows with missing or malformed values.
event_id, source_name, policy_number, claim_id, and event_code.received_at, then event_id.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique log event identifier |
| source_id | INT | Identifier of the system that generated the log |
| received_at | TIMESTAMP | Timestamp when the log was received |
| raw_message | TEXT | Unstructured log message |
| Column | Type | Description |
|---|---|---|
| source_idPK | INT | Unique source identifier |
| source_name | VARCHAR(100) | Human-readable source name |