Email Domain Distribution
Problem
**[Classic — string parsing]**
Extract the domain (everything after `@`) from each user's email and count
users per domain.
Return `domain` and `user_count`, ordered by count descending then domain.
Tables
Example rows — the live problem includes the full dataset.
users
| user_id |
|---|
Expected output
Your answer should return 3 rows with the columns domain, user_count.
Starter code (SQL)
SELECT *
FROM users;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock