Tell me about how you handle XML data in your data analysis work using SQL or related tooling.
For this exercise, work with the XML payloads stored in Boeing maintenance event records. Write a SQL query that extracts the event type, tail number, and event timestamp from the XML, keeps only rows with all three values present, and returns the latest valid record for each source system.
source_systemsource_system, event_type, tail_number, event_tsevent_ts is not nullevent_tssource_system ascendingevent_type, tail_number, and event_ts from the first text nodes at /event/type/text(), /event/tail/text(), and /event/timestamp/text(), respectively.NULL and cast event_ts to a timestamp.event_ts ties within each source_system by descending record_id.| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique record identifier |
| source_system | VARCHAR(50) | System that produced the XML record |
| ingested_at | TIMESTAMP | When the record was loaded |
| payload_xml | XML | XML payload containing event details |