task Deduplication · medium
Keep one account per email
Treat emails as equal after trimming spaces and lowercasing. For each email, keep the shopper who signed up first. Return id, name and clean_email for the kept shoppers.
what to return
- Columns
idnameclean_emailin this order- Rows
- 14 rows · any order
- Watch for
- Ties on signup_date go to the lower id.
- Shoppers with no email are excluded.
- Skill
- Deduplicate by a cleaned key, keeping a defined survivor. Refresher: Clean strings & cast values →
expected result
Your query should return exactly these columns and values. Run it and compare.
expected result14 rows · any order
| id | name | clean_email |
|---|---|---|
| 1 | Ana Ruiz | ana@harbor.test |
| 2 | Ben Okafor | ben@harbor.test |
| 3 | Chloe Park | chloe@harbor.test |
first 3 of 14 rows
data you can query
Sample rows from each table. Each column shows its type underneath; → marks a link to another table.
shoppers5 columns · 17 rows
| idinteger · key | nametext | emailtext | regiontext | signup_datetext |
|---|---|---|---|---|
| 1 | Ana Ruiz | ana@harbor.test | West | 2025-01-03 |
| 2 | Ben Okafor | ben@harbor.test | East | 2025-01-05 |
| 3 | Chloe Park | chloe@harbor.test | West | 2025-01-09 |
| 4 | Dmitri Volkov | dmitri@harbor.test | North | 2025-01-14 |
| 5 | Esi Mensah | NULL | South | 2025-01-20 |
showing 5 of 17 rows
solution.sql
Hints and the answer are always available. Using them counts the question as solved with help.