SQL · Google · Medium
You are given two tables: All timestamps are in UTC. The sample data below is small but demonstrates the required behavior. Part A — Deduplicate retried events Some payments are retried, so multiple rows can share the same (user_id, idempotency_key) pair. Write ANSI SQL that keeps exactly one row per (user_id, idempotency_key). The kept row must have the earliest event_time; if multiple rows have that same earliest timestamp, keep the one with the smallest event_id. Return…
Checking your access…