One of the columns in a table from the database is called 'name'. It contains a firstname and a surname all in one field. I need to come up with a clean, efficient way to split this single column into two.
3 columns:
Name (the firstname and surname)
Firstname(currently empty, first half of name should go here, if there is an insertion for example (Fred de Bakker), then 'Fred' should be firstname)
Surname (currently empty, second half of name should go here, if there is an insertion for example (Fred de Bakker), then 'de Bakker' should be surname)
What I need to do: Split name in half and place into firstname and surname
If anyone could shed some light on how to do this kind of thing I would really appreciate it as I haven't done anything like this in SQL before.
Database engine: MySQL Storage engine: InnoDB