I am trying to select domain name
from an email address using Athena
but my noob glasses cant find the translation that works.
As per my understanding the following should work but the required functions are missing in Athena
(SUBSTRING_INDEX(SUBSTR(sd_ccode, strpos(sd_ccode, '@') + 1),'.',1)) as Domain
would you know how these functions translate in Athena ?
2
Answers
You can use the split_part function, as in:
One more method using regexp_extract function:
Regex
'@(.*)'
here is a capturing group after @ containing any number of characters