I was trying to solve the “Most popular email domain” exercise, and I already completed it, however at first I was trying to do the following query, but it keeps getting me an error, don’t know where is failing, any clues?
WITH domains AS(
SELECT
SPLIT_PART(email, '@', 2) AS email_domain,
COUNT(*)
FROM users
)
SELECT
SPLIT_PART(email_domain, '.', 1) AS main_domain
FROM domains