Find duplicate customer emails
Each customer should have their own email address. Return every email that more than one customer uses, together with the number of customers who use it.
Rows can come back in any order. Column names do not matter; the values do.
Sample database: Shop: customers, orders, order items and payments
Four tables of an online shop. customers (id, name, email, city, created_at): the product requires an email, but in this data it may be NULL or empty; city is optional. orders (id, customer_id, total, status, created_at): status is PAID, PENDING or CANCELLED. order_items (id, order_id, product, qty, price): one row per order line, worth qty times price. payments (id, order_id, amount, status): status is SUCCESS or FAILED. Dates are text in the form YYYY-MM-DD. No foreign keys are enforced, so the data may hold mistakes.
| id | name | city | created_at | |
|---|---|---|---|---|
| 1 | Asha Rao | asha@mail.in | Pune | 2026-01-02 |
| 2 | Ravi Kumar | ravi@mail.in | Delhi | 2026-01-05 |
| 3 | Meena Iyer | meena@mail.in | Chennai | 2026-01-09 |
| 4 | John Dsouza | NULL | Mumbai | 2026-02-01 |
| 5 | Fatima Sheikh | ravi@mail.in | Delhi | 2026-02-14 |
| 6 | Karan Singh | karan@mail.in | NULL | 2026-03-01 |
| 7 | Lata Menon | lata@mail.in | Pune | 2026-03-20 |
| 8 | Nisha Paul | Kochi | 2026-04-02 |
| id | customer_id | total | status | created_at |
|---|---|---|---|---|
| 1001 | 1 | 1500 | PAID | 2026-03-01 |
| 1002 | 2 | 800 | PAID | 2026-03-02 |
| 1003 | 3 | 2200 | PAID | 2026-03-03 |
| 1004 | 9 | 450 | PAID | 2026-03-04 |
| 1005 | 1 | 300 | CANCELLED | 2026-03-05 |
| 1006 | 2 | 1250 | PAID | 2026-03-06 |
| 1007 | 3 | 600 | PAID | 2026-03-07 |
| 1008 | 5 | 999 | PENDING | 2026-03-08 |
| 1009 | 2 | 800 | PAID | 2026-03-02 |
| id | order_id | product | qty | price |
|---|---|---|---|---|
| 1 | 1001 | Keyboard | 1 | 1000 |
| 2 | 1001 | Mouse | 2 | 250 |
| 3 | 1002 | Headset | 1 | 800 |
| 4 | 1003 | Monitor | 1 | 2000 |
| 5 | 1004 | Cable | 3 | 150 |
| 6 | 1005 | Mouse | 1 | 300 |
| 7 | 1006 | Keyboard | 1 | 1000 |
| 8 | 1006 | Mouse pad | 1 | 150 |
| 9 | 1006 | Cable | 1 | 100 |
| 10 | 1007 | Webcam | 1 | 600 |
| 11 | 1009 | Headset | 1 | 800 |
| 12 | 1012 | Charger | 1 | 500 |
| id | order_id | amount | status |
|---|---|---|---|
| 501 | 1001 | 1500 | SUCCESS |
| 502 | 1002 | 800 | SUCCESS |
| 503 | 1003 | 2200 | SUCCESS |
| 504 | 1004 | 450 | SUCCESS |
| 505 | 1006 | 1250 | SUCCESS |
| 506 | 1006 | 1250 | SUCCESS |
| 507 | 1007 | 600 | FAILED |
| 508 | 1009 | 800 | SUCCESS |
Run shows your rows. Submit compares them with the expected rows.
to answer and keep your progress. Reading is free for everyone.