PostgreSQLString FunctionsSTRING_AGG
REGEXP_MATCH

STRING_AGGString Functions

FORMAT

Concatenates strings with a separator (aggregate).

Syntax

STRING_AGG(expr, sep)

Example

Enter values below to update the example in real time.

department_id
last_name
members
employees
-- 부서별 직원 목록
SELECT department_id,
       STRING_AGG(last_name, ', ' ORDER BY last_name) AS members
FROM employees
GROUP BY department_id;