COMPOSE

COMPOSE is a function in SQL used to combine rows from one or more tables into a new table based on a common column or set of columns. It merges the values of multiple columns into a single column, treating each input value as a separate argument. This helps in managing complex data sets more easily within relational database systems.

Example

SELECT
COMPOSE('%' || 'hello' || '%');

Output

compose
-----------
%hello%
(1 row)

Explanation

In the example, the COMPOSE function is used to concatenate a string with % characters on both sides, producing %hello%. Immediately following the COMPOSE function is (1 row), which indicates that the function successfully returned one row of output.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.