Easy Aggregation Free

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_idnameemailcitysignup_date
101Alice Mitchell[email protected]San Francisco2024-01-15
102Bob Chen[email protected]New York2024-02-20
103Carol Davis[email protected]Los Angeles2024-03-10
About the e-commerce sample database

Practice on your iPhone

Query Dojo for iPhone has 85 interview questions, timed mock interviews and a tile builder, so you can write queries without a keyboard.

Get the app

Keep going