runtime
37 / 88

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_email in 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
idnameclean_email
1Ana Ruizana@harbor.test
2Ben Okaforben@harbor.test
3Chloe Parkchloe@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 · keynametextemailtextregiontextsignup_datetext
1Ana Ruizana@harbor.testWest2025-01-03
2Ben Okaforben@harbor.testEast2025-01-05
3Chloe Parkchloe@harbor.testWest2025-01-09
4Dmitri Volkovdmitri@harbor.testNorth2025-01-14
5Esi MensahNULLSouth2025-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.