Difference between revisions of "CONCAT"

From SQLZOO
Jump to: navigation, search
(Created page with "<table align='right' border='1'> <caption>Compatibility</caption> <tr><th colspan='3'>CONCAT(s1, s2)</th></tr> <tr><td align='center'>'''Engine'''</td><td align='center'>'''OK...")
 
 
(3 intermediate revisions by one user not shown)
Line 3: Line 3:
 
<tr><th colspan='3'>CONCAT(s1, s2)</th></tr>
 
<tr><th colspan='3'>CONCAT(s1, s2)</th></tr>
 
<tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
 
<tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
<tr><td align='left'>ingres</td><td>No</td><td>[[LENGTH |LENGTH(S)]]</td></tr>
+
<tr><td align='left'>ingres</td><td>Yes</td><td></td></tr>
<tr><td align='left'>mysql</td><td>No</td><td>[[LENGTH |LENGTH(S)]]</td></tr>
+
<tr><td align='left'>mysql</td><td>Yes</td><td></td></tr>
<tr><td align='left'>oracle</td><td>No</td><td>[[LENGTH |LENGTH(S)]]</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>[[LENGTH |LENGTH(S)]]</td></tr>
+
<tr><td align='left'>postgres</td><td>No</td><td>s1 || s2</td></tr>
<tr><td align='left'>sqlserver</td><td>Yes</td><td>LEN(s)</td></tr>
+
<tr><td align='left'>sqlserver</td><td>No</td><td>s1 + s2</td></tr>
 
</table>
 
</table>
 
<h1>CONCAT</h1>
 
<h1>CONCAT</h1>
Line 34: Line 34:
 
<p>See also</p>
 
<p>See also</p>
 
<ul>
 
<ul>
   <li>[[SUBSTRING function]]</li>
+
   <li>[[SUBSTRING |SUBSTRING function]]</li>
 
   <li>[[TRIM |TRIM function]]</li>
 
   <li>[[TRIM |TRIM function]]</li>
 
</ul>
 
</ul>
 +
 +
{{Languages}}

Latest revision as of 10:12, 1 October 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

Language: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense