Skip to main content

ARRAY

Builds an array literal from the supplied expressions. Each argument is evaluated and stored in order. All elements must be castable to a common type.

Syntax

ARRAY(<expr1>, <expr2>, ... )

Return Type

ARRAY

Examples

SELECT ARRAY(1, 2, 3) AS arr_int;

┌─────────┐
│ arr_int │
├─────────┤
[1,2,3]
└─────────┘
SELECT ARRAY('alpha', UPPER('beta')) AS arr_text;

┌───────────┐
│ arr_text │
├───────────┤
["alpha","BETA"]
└───────────┘
SELECT ARRAY(1, NULL, 3) AS arr_with_null;

┌────────────────┐
│ arr_with_null │
├────────────────┤
[1,NULL,3]
└────────────────┘
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today