ARRAY_INTERSECT
All functions > ARRAY > ARRAY_INTERSECT
Returns the intersection of two arrays using set semantics.
Syntax
ARRAY_INTERSECT(array1, array2)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
array1 | ARRAYBIGINT | Yes | The first input array |
array2 | ARRAYBIGINT | Yes | The second input array |
Returns
An array containing the distinct elements that appear in both input arrays
Notes
- Uses set semantics: duplicates in input arrays are removed
- Returns only unique elements that exist in both arrays
- Result is sorted lexicographically
- Returns empty array if no common elements exist
- Null arrays are treated as empty arrays