task TRIM / LOWER / SUBSTR / REPLACE · easy
Emails used more than once
Some shoppers share an email once you ignore letter case and surrounding spaces. Return clean_email and shopper_count for every such email used by more than one shopper.
what to return
- Columns
clean_emailshopper_countin this order- Rows
- 2 rows · any order
- Watch for
- clean_email = the email trimmed and lowercased.
- Ignore shoppers with no email.
- Skill
- Normalise text before comparing it. Refresher: Filter groups with HAVING →
expected result
Your query should return exactly these columns and values. Run it and compare.
expected result2 rows · any order
| clean_email | shopper_count |
|---|---|
| ana@harbor.test | 2 |
| ben@harbor.test | 2 |
all 2 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.