Created September 2016, originally like 2005.

Extract Domain Names from a list of email addresses

In SQL!

SELECT count( * ) AS MyDomainCount
       , substring( user_email, LOCATE( '@', user_email ) ) AS MyDomain
FROM   `tp_users`
GROUP BY substring( user_email, LOCATE( '@', user_email ) );

In Excel!

=MID(A1,(FIND("@",A1)+1),200)

I don't remember writing these!

SELECT SUBSTRING_INDEX(email,'@',-1) AS domain FROM TABLE -- returns everything to the right of the rightmost @

SELECT SUBSTRING(email,INSTR(email,'@')+1) AS domain FROM TABLE -- returns everything to the right of the leftmost @