Sometimes it is necessary to combine together (concatenate) the results from several different fields. Each database provides a way to do this:
- MySQL: CONCAT()
- Oracle: CONCAT(), ||
- SQL Server: +
The syntax for CONCAT() is as follows:
CONCAT(str1, str2, str3, …): Concatenate str1, str2, str3, and any other strings together. Please note the Oracle CONCAT() function only allows two arguments — only two strings can be put together at a time using this function. However, it is possible to concatenate more than two strings at a time in Oracle using ‘||’.
MySQL/Oracle:
SELECT CONCAT(region_name,store_name) FROM Geography
WHERE store_name = ‘Boston’;
Result:
‘EastBoston’
Oracle:
SELECT region_name || ‘ ‘ || store_name FROM Geography
WHERE store_name = ‘Boston’;
Result:
‘East Boston’
SQL Server:
SELECT region_name + ‘ ‘ + store_name FROM Geography
WHERE store_name = ‘Boston’;
Result:
‘East Boston’



