MySQL CONCAT() Function

Example

Add several strings together:

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

Definition and Usage

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

Note: Also look at the CONCAT_WS() function.

Syntax

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:

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

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.