bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL CONCAT() Function

Concept visual

MySQL CONCAT() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

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(

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;

Previous

❮ MySQL Functions

Next

Previous

MySQL CHARACTER_LENGTH() Function

Next

MySQL CONCAT_WS() Function