We need to combine the column name and surname in the user table. For example, in the name column the value is "Ivan." And in the column surname "Ivanov". And it is necessary that in one column the name be "Ivan Ivanov".

On the screen there is a table structure: enter image description here

  • Combine physically, or in a sample? - LEQADA
  • @LEQADA in mysql newbie, I do not understand what was asked - Merlin
  • Could you give an example of what should be the result? - LEQADA
  • one
    @Merlin, try in the answer instead of name + ' ' + surname; do concat_ws(' ', name, surname) , add numbers, not strings, therefore 0 - BOPOH
  • 3
    @Merlin, so this is it, BOPOH helped you) - LEQADA

1 answer 1

increase the size of the varchar type

 alter table users alter column name varchar(125); 

update data

 update users set name = name + ' ' + surname; 

remove surname column

 alter table users drop column surname; 
  • 3
    numbers are added, not strings; strings must be combined; correct on concat or concat_ws , otherwise your answer is just because of this and is not correct - BOPOH