MySQL CONCAT() Function

Example

Add several strings together:

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

CONCAT(expression1expression2expression3,...)

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:

SELECT CONCAT(Address, " ", PostalCode, " ", City) AS Address
FROM Customers;

-

 


Login
ADS CODE