Skip to Main Content
SQL in a Nutshell
book

SQL in a Nutshell

by Kevin Kline
December 2000
Intermediate to advanced content levelIntermediate to advanced
224 pages
9h 52m
English
O'Reilly Media, Inc.
Content preview from SQL in a Nutshell

Name

Concatenation Operators

Synopsis

When it is necessary to combine the data of multiple columns into a single column in SELECT result set, the concatenation symbol supported by the DBMS may be used to achieve this result.

Vendor

Command

SQL Server

Supported, with variations

MySQL

Supported, with variations

Oracle

Supported

PostgreSQL

Supported

Example and Description

SELECT lname || ', ' || fname FROM customers WHERE cust_id = 41;

The ANSI standard is a double-pipe mark ( || ), as shown in the previous code example, and is supported by Oracle and PostgreSQL.

Microsoft SQL Server uses a plus sign ( + ) as its concatenation symbol.

MySQL uses the CONCAT(string1, numeric1, string2, numeric2 [,...n]) function to accomplish concatenation.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL in a Nutshell, 3rd Edition

SQL in a Nutshell, 3rd Edition

Kevin Kline

Publisher Resources

ISBN: 1565927443