Extract all the distinct email id domain from all the employee

Question

Suppose there are two columns in employee table i.e. emp id and email
get all the unique domainsĀ  like gmail.com, yahoo.com, outlook.com, etc.

solved 6
TheDataMonk 55 years 18 Answers 2615 views Grand Master 0

Answers ( 18 )

  1. Sorry it a private answer.

  2. SELECT DISTINCT (SUBSTRING(E.email, 0, (CHARINDEX(‘@’,E.email)+1))) as domain_name
    FROM employee E

  3. Select Distinct(Substring(email,(charindex(‘@’,email))+1))
    From employee;

  4. SELECT disticnct(substring(‘[email protected]’,CHARINDEX(‘@’, ‘[email protected]’)+1,19) )AS MatchPosition;

    0

    SELECT distinct split_part(email,’@’,2) as domain FROM employee

  5. SELECT distinct substring(EMAIL,charindex(‘@’,email) + 1,LEN(EMAIL) ) from avi

    SELECT distinct VALUE from avi
    CROSS APPLY STRING_SPLIT(EMAIL, ‘@’)
    WHERE VALUE LIKE ‘%com’;

    SELECT DISTINCT RIGHT(EMAIL,LEN(substring(EMAIL,charindex(‘@’,email) + 1,LEN(EMAIL) ))) –,RIGHT(EMAIL, substring(EMAIL,0,charindex(‘@’,email)) )
    from avi;

    1

    Select distinct regexp_replace(email,’.+@(.+)’,’\1′) from employee

  6. Select right(email,len(email)-substr(email,1,Position(@ in email))) from employees

  7. select distinct emailid from emails
    where SUBSTRING_INDEX(emailid , ‘@’ , -1);

  8. select substr(email, instr(email, ‘@’) + 1, length(email)) as Domain from emp1;

    Best answer
  9. SELECT DISTINCT SPLIT_PART(email,’@’,2) AS domain_name
    FROM employees

  10. select distinct split_part(email,’@’,2)as doman_name
    from
    employee

  11. SELECT SUBSTR(email, instr(email, ‘@’) +1, length(email)) as domain from Employee

Leave an answer

Browse
Browse