THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL CONCAT() Function

❮ MySQL Functions

Example

Concatenate several expressions together:

SELECT CONCAT("SQL ", "Tutorial ", "is ", "fun!") AS ConcatenatedString;
Try it Yourself »

Definition and Usage

The CONCAT() function concatenates two or more expressions together.

Note: See also the CONCAT_WS() function.

Syntax

CONCAT(expression1, expression2, expression3,...)

Parameter Values

Parameter Description
expression1,
expression2,
expression3,
etc.
Required. The expressions to concatenate together.

Note: If expression is a numeric value, it will be converted to a binary string. If all expressions are nonbinary strings, this function will return a nonbinary string. If any of the expressions is a binary string, this function will return a binary string. If any of the expressions is a NULL, this function will return a NULL value.

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

More Examples

Example

Concatenate three columns into one "Address" column:

SELECT CONCAT(Address, " ", PostalCode, " ", City) AS Address
FROM Customers;
Try it Yourself »

❮ MySQL Functions