Use of Concatenation Operator in SQL

Posted by tagicon_admin | August 2, 2015 | in : SQL

Concatenation operator is used to links or add columns or character srtings to other columns or character. Concatenation
is represented by two vertical bars (||). When we use concatenatin operator, we can change a column heading by using a
column alias.
Syntax of Concatenation Operator:
=================================

string1 || string2 [ || string_n]
Here I am showing two example for different between SQL statement without concatenation operator and SQL statement with concatenation operator:

–> SQL statement without concatenation operator:

 

Above query will make the following result:

 

–>SQL statement with concatenation operator:

 

Above query will make the following result:

 

–> SQL statement with concatenation operator and using column aliase to change the column heading

 

Above query will make the following result:

 

Now I am showing more example of concatenation operator below:

–> Concatenating two NUMBERS

 

Above query will make the following result:

 

–> Retrieve string with single quote by using concatenation operator.

 

Above query will make the following result:

 

–>Retrieve department id, first name, job id, hire date, salary and employee id by using concatenation operator. Name the coloumn title Employees History.

 

Above query will make the following result:

 

 

–> Retrieve multiple column data with string by using concatenation operator.

 

Above query will make the following result:

 

Related Posts

Leave a Reply