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

Keep going