How can I split name in SQL -


i have column in table 1000 names. want make new column splitting name in new format: example:

santosh kumar yadav 

it should be:

santosh k yadav 

middle name initials , rest name should same.

how can ?

if want replace second name initial. here's idea mysql database.

assuming name of names column name & new column want put data formatted_name. try this.

update users  set formatted_name = replace(                              name,                              substring_index(substring_index(name, ' ', 2), ' ', -1),                               left(substring_index(substring_index(name, ' ', 2), ' ', -1), 1)                              ); 

here's demo http://sqlfiddle.com/#!9/4e5f95


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -