Combine multiple strings into a single string by adding them together.
SELECT CONCAT(“SQL “, “Tutorial “, “is “, “fun!”) AS ConcatenatedString; |
The CONCAT() function merges two or more expressions.
Note: Additionally, consider exploring the CONCAT_WS() function.
CONCAT(expression1, expression2, expression3,…) |
Parameter |
Description |
expression1, |
Necessary: The expressions to be combined. Note: If any of the expressions are NULL values, the function returns NULL. |
Works in: | From MySQL 4.0 |
Combine the data from three columns into a single column named “Address”.
SELECT CONCAT(Address, ” “, PostalCode, ” “, City) AS Address FROM Customers; |