Using the function to split strings: http://blog.fedecarg.com/2009/02/22/mysql-split-string-function/
SELECT SUBSTRING_INDEX( SUBSTRING_INDEX( fullname, ' ', 1 ) , ' ', -1 ) AS firstname,
SUBSTRING_INDEX( SUBSTRING_INDEX( fullname, ' ', 2 ) , ' ', -1 ) AS lastname
FROM users;
I get the following resuts:
firstname | lastname |
john doe
jane doe
I have the following questions:
1.)How can I insert the values on columns that already exist under the same table?
2.)How can I insert the values on columns that don’t exist under the same table?
Of course, the two columns being firstname | lastname
To insert these values:
To update existing values, for the same row:
To update existing values, but a different row: