Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

CONCAT

Example

Combine multiple strings into a single string by adding them together.

SELECT CONCAT(“SQL “, “Tutorial “, “is “, “fun!”) AS ConcatenatedString; 

Definition and Usage

The CONCAT() function merges two or more expressions.

Note: Additionally, consider exploring the CONCAT_WS() function.

Syntax

CONCAT(expression1, expression2, expression3,…)

Parameter Values

Parameter

Description

expression1,
expression2,
expression3,
etc.

Necessary: The expressions to be combined.

Note: If any of the expressions are NULL values, the function returns NULL.

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Combine the data from three columns into a single column named “Address”.

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