Difference between revisions of "Strings"

From SQLZOO
Jump to: navigation, search
 
Line 4: Line 4:
 
<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>Yes</td><td></td></tr>
 
<tr><td align='left'>ingres</td><td>Yes</td><td></td></tr>
<tr><td align='left'>mysql</td><td>No</td><td>CONCAT(s1,s2)</td></tr>
+
<tr><td align='left'>mysql</td><td>No</td><td>[[CONCAT | CONCAT(s1,s2)]]</td></tr>
 
<tr><td align='left'>oracle</td><td>Yes</td><td></td></tr>
 
<tr><td align='left'>oracle</td><td>Yes</td><td></td></tr>
 
<tr><td align='left'>postgres</td><td>Yes</td><td></td></tr>
 
<tr><td align='left'>postgres</td><td>Yes</td><td></td></tr>

Latest revision as of 18:22, 21 October 2012

Compatibility
s1 || s2
EngineOKAlternative
ingresYes
mysqlNo CONCAT(s1,s2)
oracleYes
postgresYes
sqlserverNos1 + s2

|| (strings)

|| allows you to stick two or more strings together.

This operation is concatenation.

   s1 || s2    

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

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

See also

Language: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense