CONCAT is a function to concatenate two or more strings into one.
This function can have two or more arguments, each of the strings to merge.
Examples:
SELECT
CONCAT('Hello', 'world!');
concat
--------------
Helloworld!
(1 row)
SELECT
CONCAT('Hello', ' ', 'world!');
concat
--------------
Hello world!
(1 row)
CONCAT_WS is a function to concatenate two or more strings with a separator. This function can have three or more arguments:
- separator is the string to between the others, it could be a space or whatever;
- string1 is the first string to merge
- string2 is the other string to merge
- string_n is the third or more string to merge;
Example:
SELECT
CONCAT_WS(' ', 'Hello', 'world!');
concat
--------------
Hello world!
(1 row)
No comments:
Post a Comment