Postgres Get Count of Email Domains
In this case function split_part
can be used:
select split_part(email, '@', 2) "domain", count(*)
from emails
group by "domain";
PostgreSQL split_part fiddle
My first idea would be to extract the domain and group by that:
select substring(email from '@(.*)$') as domain, count(*)
from "user"
group by domain