SQL Tutorial will explain us that sometimes it is necessary to combine together (concatenate) the results from several different fields
from one or more database tables. Each database provides a way to do this but
each database follows the different way from others.
The syntax for
CONCAT() Function is as follows:
CONCAT(str1, str2, str3, ...): Concatenate str1,
str2, str3, and any other strings together. Please note
the Oracle database
CONCAT() function only allows two arguments --
only two strings can be put together at a time using this
function. However, it is possible to concatenate more than
two strings at a time in database Oracle using '||' sign.
Let's look at some SQL Concatenate examples. Assume we have
the following table:
Table:
Employees
| FirstName |
LastName |
Email |
DOB |
Phone |
| Austin |
Hennery |
austin.it@gamail.com |
24/11/1978 |
446 102-2222 |
| Creston |
Narvon |
narvon_crest@hotmail.com |
22/04/1976 |
443 325-4545 |
| Kate |
Bladen |
kbladen@usa.net |
01/05/1980 |
326 503-3232 |
| Angela |
Julie |
julieee@yahoo.co.uk |
11/12/1977 |
326 323-8888 |
| Bobbi |
Ferguson |
bobi123@kiwibox.com |
10/02/1970 |
506 252-9875 |
| Cute |
Alfa |
cafa@gmail.com |
19/05/1972 |
506 272-4566 |