Search
 
SCRIPT & CODE EXAMPLE
 

SQL

create email address from first and last name in sql

# NB: This creates email addresses with the format
# first_name.last_name@company_name.com
# Name of table = names_table
# Name of column containing names = full_name
# Simply change the table and column name to what corresponds with your dataset

WITH temp_table AS (
	SELECT LEFT(full_name, STRPOS(primary_poc, ' ') -1 ) AS first_name,  
  			RIGHT(full_name, LENGTH(primary_poc) - STRPOS(primary_poc, ' ')) AS last_name, name
	FROM names_table)

SELECT CONCAT(first_name, '.', last_name, '@', 'company_name.com')
FROM temp_table;
Comment

PREVIOUS NEXT
Code Example
Sql :: sql where last 12 months 
Sql :: convert float to int sql 
Sql :: sql remanecolumn 
Sql :: Mysql Workbench takes very long time to execute the first query 
Sql :: delete entries in postgresql 
Sql :: mysql change root password ubuntu 
Sql :: postgres truncate with cascade 
Sql :: function difference_in_hours(timestamp with time zone) does not exist 
Sql :: age postgres 
Sql :: oracle set date format 
Sql :: apex ORA-20999 
Sql :: group by mysql and concatenate string 
Sql :: mysql user permission database 
Sql :: mysql extract month 
Sql :: postgresql transaction discard all 
Sql :: convert uniqueidentifier to varchar in sql 
Sql :: how to delete a column in sql 
Sql :: truncate table 
Sql :: mysql change data type of column 
Sql :: oracle update with sequence 
Sql :: table drop if exist sql server 
Sql :: adding a check statement in sql 
Sql :: mysql select last row for each group 
Sql :: mysql time ago difference 
Sql :: how to create an empty table from an existing table 
Sql :: upper and lower in oracle sql 
Sql :: add auto increment column mysql 
Sql :: mysql load data infile csv 
Sql :: uppercase and lowercase in sql 
Sql :: how to pass password mysql command line 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =