正解:A
The clearly correct answer from the listed options is A. ARRAY_AGG .
Important correction:
The provided answer A, D is not fully correct if the question is asking about aggregate functions .
ARRAY_CONSTRUCT creates an array from explicitly supplied values, but it does not aggregate values across multiple rows.
Why A is correct:
ARRAY_AGG is an aggregate function. It aggregates input values from multiple rows into a single array.
Example:
SELECT ARRAY_AGG(product_id)
FROM orders;
This returns an array containing product_id values from multiple rows.
Why D is not an aggregate function:
ARRAY_CONSTRUCT creates an array from the values passed into the function.
Example:
SELECT ARRAY_CONSTRUCT( ' A ' , ' B ' , ' C ' );
This creates an array from listed expressions, but it does not aggregate values across rows.
Why the other options are incorrect:
B). ARRAY_SLICE returns a subset of an existing array.
C). ARRAY_APPEND appends a value to an existing array.
E). ARRAY_TO_STRING converts an array to a string.
Official Snowflake documentation reference:
Snowflake documentation describes ARRAY_AGG as an aggregate function that returns the input values, pivoted into an array. ARRAY_CONSTRUCT is documented as a scalar function that constructs an array from input expressions.
Reference: Snowflake Documentation - ARRAY_AGG; Snowflake Documentation - ARRAY_CONSTRUCT; SnowPro Core Study Guide - Working with Semi-Structured Data.
==