Open In App

PostgreSQL- CONCAT Function

In PostgreSQL, the CONCAT function is used to concatenate two or more strings into one.

Syntax: CONCAT(string_1, string_2, ...)

Let’s analyze the above syntax:



Example 1:

The below statement uses the CONCAT function to concatenate three strings into one:



SELECT
 CONCAT ('Geeks', 'for', 'geeks');

Output:

Example 2:

The following statement concatenates values in the first_name and last_name columns of the actor table in the sample database, ie, dvdrental.

SELECT
    CONCAT  (first_name, ' ', last_name) AS "Full name"
FROM
    actor;

Output:

Article Tags :