- Categories:
Semi-structured and structured data functions (Array/Object)
ARRAY_ CONSTRUCT¶
Returns an array constructed from zero, one, or more inputs.
For more information about constructing and using arrays, see ARRAY.
- See also:
Syntax¶
Arguments¶
The arguments are values (or expressions that evaluate to values). The argument values can be different data types.
Returns¶
The data type of the returned value is ARRAY.
Usage notes¶
- If the function is called with
Narguments, the size of the resulting array isN. - In many contexts, you can use an ARRAY constant (also called an ARRAY literal) instead of the ARRAY_CONSTRUCT function.
- An array can contain both SQL NULL values and JSON null values. For more information, see NULL values.
Examples¶
Construct a basic array consisting of numeric data types:
Construct a basic array consisting of different data types, including a SQL NULL value (undefined) and
a JSON null value (null):
Construct an empty array:
Create a table and insert arrays into an ARRAY column: