From Exercise 66:
Let’s practice our newly learned skill of grouping and counting. Which email domain has the most amount of users at Bindle?
I am writing a code other way, by forming function. I am getting error. Could anyone help me to identify where I have mistaken?
WITH domain AS ( SELECT SPLIT_PART (email, '@', 2) AS email_domain, FROM users ) SELECT email_domain, COUNT(*) FROM domain GROUP BY 1 ORDER BY 2 DESC