PostgreSQL ARRAY_CAT() function
ARRAY_CAT() function
The ARRAY_CAT() function in PostgreSQL is designed to merge two arrays into a single array. By concatenating the elements of the second array to the end of the first array, this function allows for seamless combination of multiple arrays.
Uses of the PostgreSQL ARRAY_CAT() Function
- Combining Arrays: Merge two arrays into one for consolidated data representation.
- Extending Arrays: Add multiple elements to an existing array efficiently.
- Data Aggregation: Aggregate data from different sources into a single array.
- Dynamic Array Construction: Build complex arrays by concatenating simpler arrays.
Syntax:
array_cat (anyarray, anyarray)
Return Type:
anyarray
PostgreSQL Version: 9.3
Example: PostgreSQL ARRAY_CAT() function
Code:
SELECT array_cat(ARRAY[1,2,3], ARRAY[4,5]);
Sample Output:
array_cat ------------- {1,2,3,4,5} (1 row)
Previous: ARRAY_APPEND function
Next: ARRAY_NDIMS function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/PostgreSQL/postgresql_array_cat-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics