Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

PostgreSQL- CONCAT Function

  • Last Updated : 08 Feb, 2021

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:

  • The CONCAT function accepts a list of string convertible arguments. A string in this context means any of the following data types: char, varchar, or text.
  • The CONCAT function is variadic meaning that the CONCAT function can accept an array as the argument. Here it is required to mark the array with the VARIADIC keyword. The CONCAT function considers every array element as an argument.
  • Contrary to the concatenation operator ( || ), the CONCAT function ignores NULL arguments. 

Example 1:

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

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


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.

    CONCAT  (first_name, ' ', last_name) AS "Full name"


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!