December 2000
Intermediate to advanced
224 pages
9h 52m
English
Concatenation Operators
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 |
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.