Example
Add several strings together:
sql
SELECT CONCAT("SQL ", "Tutorial ", "is ", "fun!") AS ConcatenatedString;
Definition and Usage
The CONCAT() function adds two or more expressions together.
Note: Also look at the CONCAT_WS() function.
Syntax
text
CONCAT(expression1, expression2, expression3,...)
Parameter Values
| Parameter | Description |
|---|---|
| expression1,expression2,expression3,etc. | Required. The expressions to add together. Note: If any of the expressions is a NULL value, it returns NULL |
Technical Details
| Works in: | From MySQL 4.0 |
|---|
More Examples
Example
Add three columns into one "Address" column:
sql
SELECT CONCAT(Address, " ", PostalCode, " ", City) AS Address
FROM
Customers;