Loading the editor…
Find email addresses that were captured more than once.
The same person can submit a form on two campaigns. Sales wants the duplicate addresses before they assign two owners.
Return email and lead_count. Keep emails that appear on more than one lead. Sort by lead_count descending, then email.
| id | name | channel | spend | started_on |
|---|---|---|---|---|
| 1 | Spring Search | paid_search | 4200 | 2025-03-01 |
| 2 | Lifecycle Email | 800 | 2025-03-01 | |
| 3 | Podcast Tour | podcast | 2500 | 2025-04-01 |
| id | campaign_id | status | created_at | |
|---|---|---|---|---|
| 1 | 1 | ada@example.com | new | 2025-03-05 |
| 2 | 1 | ada@example.com | qualified | 2025-03-08 |
| 3 | 2 | lin@example.com | new | 2025-03-11 |
Ctrl or Cmd + Enter runs the query. The database resets on every run.
Run the query to see rows from the sample database.
Next exercise: Second-month user retention
Related: Leads still marked new, Customers with repeat orders