How would you identify and remove duplicate customer records from a table without a primary key at The Home Depot?
Assume duplicate rows are defined by matching email, first_name, last_name, and phone_number. Write a SQL query to keep one row per duplicate set and remove the rest.
created_at row, and break any ties by the smallest ctidemail, then created_at, then ctid| Column | Type | Description |
|---|---|---|
| customer_id | BIGINT | Surrogate-style identifier present in the source, but not guaranteed to be unique |
| first_name | VARCHAR(100) | Customer first name |
| last_name | VARCHAR(100) | Customer last name |
| VARCHAR(255) | Customer email address | |
| phone_number | VARCHAR(30) | Customer phone number |
| created_at | TIMESTAMP | Record creation timestamp |