Difference between revisions of "Strings"

From SQLZOO
Jump to: navigation, search
Line 18: Line 18:
 
<div class='ht'>
 
<div class='ht'>
 
In this example you put the region and the name together for each country.  
 
In this example you put the region and the name together for each country.  
<source lang='sql' class='def e-oracle e-mysql'>
+
<source lang='sql' class='def e-mysql'>
 
SELECT CONCAT(region,name)
 
SELECT CONCAT(region,name)
 
   FROM bbc
 
   FROM bbc

Revision as of 14:34, 16 July 2012

Compatibility
s1 || s2
EngineOKAlternative
ingresYes
mysqlNoCONCAT(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

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense