How would you write a SQL query to identify candidate records with duplicate email addresses and return the most recent registration for each email?
Assume duplicate detection uses exact, non-NULL email values. If registration timestamps tie, select the candidate with the highest candidate_id.
candidate_id, email, full_name, registered_at, and duplicate_countemail ascending| Column | Type | Description |
|---|---|---|
| candidate_idPK | INT | Unique candidate registration identifier |
| VARCHAR(255) | Candidate email address | |
| full_name | VARCHAR(150) | Candidate full name |
| registered_at | TIMESTAMP | Timestamp when the candidate registered |