Given a scenario with duplicate user event logs, write a deduplication query that retains only the latest record per session.
Use the user_event_logs table. Treat the greatest event_timestamp as latest; if timestamps tie, retain the row with the greatest event_id.
event_id, user_id, session_id, event_type, and event_timestamp.session_id ascending.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique identifier for the logged event |
| user_id | INT | Identifier of the user associated with the event |
| session_id | VARCHAR(50) | Identifier of the user session |
| event_type | VARCHAR(50) | Type of event recorded |
| event_timestamp | TIMESTAMP | Timestamp when the event was recorded |