Concatenate Columns

From SQLZOO
Revision as of 16:36, 10 July 2012 by Marek (Talk | contribs)

Jump to: navigation, search

You can put two or more strings together using the concatenate operator.

You can put two or more strings together using the concatentate operator. The SQL standard says you should use || but there are many differences between the main vendors.

CREATE TABLE bbc (name VARCHAR(10), region VARCHAR(10));
INSERT INTO bbc VALUES ('Poland', 'Europe');
INSERT INTO bbc VALUES ('Japan', 'Asia');
SELECT region & name
  FROM bbc
SELECT region + name
  FROM bbc
SELECT CONCAT(region, name)
  FROM bbc
SELECT region || name
  FROM bbc
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense