SQL interview question: Extract the Email Domain
Email Domain Analysis
Marketing wants to know which email providers customers use most.
Extract the domain (everything after @) from each customer's email and count how many customers use each domain.
Return domain and customer_count. Order by customer_count descending.
Skills: SUBSTR and INSTR for string manipulation
Tables
customers 12 rows
- customer_id integer PK
- name text
- email text
- city text
- signup_date text
| customer_id | name | city | signup_date | |
|---|---|---|---|---|
| 101 | Alice Mitchell | [email protected] | San Francisco | 2024-01-15 |
| 102 | Bob Chen | [email protected] | New York | 2024-02-20 |
| 103 | Carol Davis | [email protected] | Los Angeles | 2024-03-10 |