Skip to content

Instantly share code, notes, and snippets.

@aaronbuchanan
Created September 1, 2015 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aaronbuchanan/ddcf362b4492cc61503f to your computer and use it in GitHub Desktop.
Save aaronbuchanan/ddcf362b4492cc61503f to your computer and use it in GitHub Desktop.
MYSQL statement to parse the domain of an email and show the most common domains
select count(*) as occurrances, substring_index(email, "@", -1) as domain
from users
group by substring_index(email, "@", -1)
ORDER by occurrances DESC
limit 100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment