How to use the CONCAT MySql function to concatenate 2 table columns

The CONCAT function can be used to concatenate two strings to form a single string or two columns to form a single column.

Say for Example you have a table users with columns name and surname and you would like to display both as one name you would use the CONCAT function to join the two fields as in the Example below

SELECT CONCAT(name," ",surname) AS fullname FROM users;

The above code will display something similar to Joe Soap should Joe be stored in the name column and Soap be stored in the surname column.

Image Credits: Photo by Isis França on Unsplash.

More Similar Posts

No results found.