Difference between revisions of "CONCAT"

From SQLZOO
Jump to: navigation, search
Line 5: Line 5:
 
<tr><td align='left'>ingres</td><td>Yes</td><td></td></tr>
 
<tr><td align='left'>ingres</td><td>Yes</td><td></td></tr>
 
<tr><td align='left'>mysql</td><td>Yes</td><td></td></tr>
 
<tr><td align='left'>mysql</td><td>Yes</td><td></td></tr>
<tr><td align='left'>oracle</td><td>No</td><td>[[s1 || s2]]</td></tr>
+
<tr><td align='left'>oracle</td><td>No</td><td>s1 || s2</td></tr>
<tr><td align='left'>postgres</td><td>No</td><td>[[s1 || s2]]</td></tr>
+
<tr><td align='left'>postgres</td><td>No</td><td>s1 || s2</td></tr>
 
<tr><td align='left'>sqlserver</td><td>No</td><td>s1 + s2</td></tr>
 
<tr><td align='left'>sqlserver</td><td>No</td><td>s1 + s2</td></tr>
 
</table>
 
</table>

Revision as of 14:21, 16 July 2012

Compatibility
CONCAT(s1, s2)
EngineOKAlternative
ingresYes
mysqlYes
oracleNos1 || s2
postgresNos1 || s2
sqlserverNos1 + s2

CONCAT

CONCAT allows you to stick two or more strings together.

This operation is concatenation.

   CONCAT(s1, s2 ...)   

In this example you put the region and the name together for each country.

SELECT region || name
  FROM bbc
SELECT region + name
  FROM bbc
SELECT CONCAT(region,name)
  FROM bbc

See also

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense