Brief
Link each event to the registry version valid at the event time and spot labels with no matching version.
Voss displays a report screenshot claiming the prototype was on the road during the crash. Mara lays two label records on the table, separated at 20:00 UTC. Imani gives you R1 at 19:30 and R2 at 21:25; both say NOCTIS-01. Explain clearly why attaching the older record to R2 is misleading before the screenshot spreads further. The urgency is part of the story; the exercise has no timer.
Your mission
- Assign R1 and R2 to their correct registry periods.
- Write the two time comparisons needed for a temporal join.
- Explain how LEFT JOIN and time conditions in ON expose events without a registry match.
- State an accurate conclusion about R2 and a check still needed.
How to check your work
- R1 matches PROTOTYPE-01 and R2 matches SHELL-02 in the copy.
- event_at >= valid_from and event_at < valid_to, except for NULL end.
- An unmatched fact remains with NULL for the joined asset.
- The source links R2 to a shell; the physical object still needs corroboration.
Course example
CREATE TABLE road_events (
event_id TEXT PRIMARY KEY,
event_at TEXT NOT NULL,
vehicle_label TEXT NOT NULL
);
CREATE TABLE label_history (
vehicle_label TEXT NOT NULL,
physical_asset TEXT NOT NULL,
valid_from TEXT NOT NULL,
valid_to TEXT
);
INSERT INTO road_events VALUES
('R1', '2026-04-12T19:30:00Z', 'NOCTIS-01'),
('R2', '2026-04-12T21:25:00Z', 'NOCTIS-01');
INSERT INTO label_history VALUES
('NOCTIS-01', 'PROTOTYPE-01', '2026-04-01T00:00:00Z', '2026-04-12T20:00:00Z'),
('NOCTIS-01', 'SHELL-02', '2026-04-12T20:00:00Z', NULL);
SELECT e.event_id, e.event_at, h.physical_asset
FROM road_events AS e
LEFT JOIN label_history AS h
ON e.vehicle_label = h.vehicle_label
AND e.event_at >= h.valid_from
AND (h.valid_to IS NULL OR e.event_at < h.valid_to)
ORDER BY e.event_id;