how to concat two columns in sql?

MySQL CONCAT() Function

To concatenate two columns in SQL, you can use the CONCAT function. The syntax is as follows:

SELECT CONCAT(column1, column2) AS new_column_name FROM table_name;

In the above syntax, column1 and column2 are the names of the columns you want to concatenate, new_column_name is the name of the new column that will contain the concatenated result, and table_name is the name of the table containing the columns.

For example, if you have a table named employees with columns first_name and last_name, you can concatenate them into a new column called full_name like this:

SELECT CONCAT(first_name, ' ', last_name) AS full_name FROM employees;

This will create a new column called full_name that contains the concatenated values of first_name and last_name, separated by a space.

Note that the CONCAT function can be used to concatenate more than two columns by simply adding additional column names as arguments.

Also Read This ๐Ÿ‘‰   Simple Laravel Contact Us Form With Email Example