An IoT ingestion pipeline lands raw sensor data in device_readings — devices
report repeatedly, and replays can duplicate timestamps:
device_readings (
reading_id INTEGER PRIMARY KEY, -- monotonically increasing ingest id
device_id TEXT,
temperature INTEGER,
recorded_at TEXT -- 'YYYY-MM-DD HH:MM:SS'
)
Write a SQL query that returns exactly one row per device: its most recent
reading. If two readings share the same recorded_at for a device, prefer the
one with the higher reading_id (later ingest wins).
Return columns: device_id, temperature, recorded_at.
Order by device_id ASC.