Concatenate strings

From SQLZOO
Jump to navigation Jump to search

Concatenate strings.

schema:gisq

Concatenation means "stick strings together". In this example we concatenate three strings, name and region are string attributes of the table, ' is in ' is a string literal.

SELECT name & ' is in ' & region
  FROM bbc
  WHERE name LIKE 'D%'
SELECT name + ' is in ' + region
 FROM bbc
 WHERE name LIKE 'D%'
SELECT CONCAT(name, ' is in ', region)
  FROM bbc
  WHERE name LIKE 'D%'
SELECT name || ' is in ' || region
 FROM bbc
 WHERE name LIKE 'D%'


DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects