create email address from first and last name in sql

Solutions on MaxInterview for create email address from first and last name in sql by the best coders in the world

showing results for - "create email address from first and last name in sql"
Oona
19 Jan 2017
1# NB: This creates email addresses with the format
2# first_name.last_name@company_name.com
3# Name of table = names_table
4# Name of column containing names = full_name
5# Simply change the table and column name to what corresponds with your dataset
6
7WITH temp_table AS (
8	SELECT LEFT(full_name, STRPOS(primary_poc, ' ') -1 ) AS first_name,  
9  			RIGHT(full_name, LENGTH(primary_poc) - STRPOS(primary_poc, ' ')) AS last_name, name
10	FROM names_table)
11
12SELECT CONCAT(first_name, '.', last_name, '@', 'company_name.com')
13FROM temp_table;