MySQL Tutorial MySQL Advanced MySQL Database Account Management MySQL References

MySQL CONCAT() Function

The MySQL CONCAT() function is used to concatenate two or more expressions together. This function may have one or more arguments. Note the following points while using this function:

  • If expression is a numeric value, it will be converted to a binary string by this function.
  • 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.


CONCAT(expr1, expr2, ... expr_n)


expr1, expr2, ... expr_n Required. Specify the expressions to concatenate together.

Return Value

Returns the concatenated string.

Example 1:

The example below shows the usage of CONCAT() function.

mysql> SELECT CONCAT('SQL ', 'Tutorial');
Result: 'SQL Tutorial'

mysql> SELECT CONCAT('Learning ', 'SQL ', 'is ', 'fun!.');
Result: 'Learning SQL is fun!.'

mysql> SELECT CONCAT('Sum is ', 25 + 25);
Result: 'Sum is 50'

mysql> SELECT CONCAT('Alpha ', 'Beta', ' Gamma');
Result: 'Alpha Beta Gamma'

mysql> SELECT CONCAT('Alpha ', 'Beta', ' Gamma', NULL);
Result: NULL

Example 2:

Consider a database table called Employee with the following records:


In the query below, the CONCAT() function is used to concatenate records of column FirstName and column LastName.

SELECT *, CONCAT(FirstName, ' ', LastName) AS FullName FROM Employee;

This will produce the result as shown below:

1JohnSmithJohn Smith
2MarryKnightMarry Knight
3JoWilliamsJo Williams
4KimFischerKim Fischer
5RameshGuptaRamesh Gupta
6HuangZhangHuang Zhang

❮ MySQL Functions