CONCAT
Concatenates the text representations of all arguments into one string.
PostgreSQL 17.5
CONCAT(value[, ...])Parameters
- value
- Value of any type, converted to text
Return value
A string (text); NULL arguments are skipped, so the result is never NULL
Examples
Joining two strings
PostgreSQL 17.5
SELECT CONCAT('Post', 'greSQL');NULL and a number among the arguments
PostgreSQL 17.5
SELECT CONCAT('Post', NULL, 'greSQL', 17);Name and status from a table
PostgreSQL 17.5
SELECT CONCAT(member_name, ' (', status, ')') AS member
FROM FamilyMembers;Details
The || operator also joins strings, but gives NULL with NULL: 'a' || NULL returns NULL, while CONCAT('a', NULL) returns a.