Concatenation of strings
You can concatenate strings by using the CONCAT operator or the CONCAT built-in function.
When the operands of two strings are concatenated, the result of the expression is a string. The operands of concatenation must be compatible strings.
Example: Consider this query:
SELECT LASTNAME CONCAT ',' CONCAT FIRSTNME
FROM EMP;
This SELECT statement concatenates the last name, a comma, and the first name of each result row. The result table looks like this:
================
HAAS,CHRISTINE
THOMPSON,MICHAEL
KWAN,SALLY
STERN,IRVING
⋮
Alternative syntax for the SELECT statement shown above is as follows:
SELECT LASTNAME CONCAT(CONCAT(LASTNAME,','),FIRSTNME)
FROM EMP;
In this case, the SELECT statement concatenates the last name and then concatenates that result to the first name.