Deduplicate Records, Keeping the Latest

medium
Unit 14 · Window Functions VII0/3 to milestone

A CRM export has duplicate customers: the same name (ignoring case) signed up more than once. Keep only the most recent sign-up for each name (latest signup_date; if those tie, the higher id). Return id, name, country and signup_date for the kept rows, sorted by id.

Schema

customers(id, name, country, signup_date)
orders(id, customer_id, order_date, total)
#window-functions#deduplication#data-quality2 visible + 1 hidden tests
query.sql · SQLite
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Deduplicate Records, Keeping the Latest · TechGradify