split first name and last name in sql

Solutions on MaxInterview for split first name and last name in sql by the best coders in the world

showing results for - "split first name and last name in sql"
Juliana
02 Mar 2018
1# Name of table = names_table
2# Name of column containing names = full_name
3# Simply change the table and column name to what corresponds with your dataset
4
5SELECT LEFT(full_name, STRPOS(primary_poc, ' ') -1 ) AS first_name,  
6  		RIGHT(full_name, LENGTH(primary_poc) - STRPOS(primary_poc, ' ')) AS last_name, name
7FROM names_table;
8
9# NB: This does not capture middle names