- Categories:
Semi-structured Data Functions (Array/Object)
ARRAY_PREPENDΒΆ
Returns an array containing the new element as well as all elements from the source array. The new element is positioned at the beginning of the array.
- See also:
SyntaxΒΆ
ARRAY_PREPEND( <array> , <new_element> )
ArgumentsΒΆ
array
The source array.
new_element
The element to be prepended.
ReturnsΒΆ
This returns the updated array.
ExamplesΒΆ
The example below shows that the prepended element is placed at the beginning of the array:
SELECT ARRAY_PREPEND(ARRAY_CONSTRUCT(0,1,2,3),'hello'); +-------------------------------------------------+ | ARRAY_PREPEND(ARRAY_CONSTRUCT(0,1,2,3),'HELLO') | |-------------------------------------------------| | [ | | "hello", | | 0, | | 1, | | 2, | | 3 | | ] | +-------------------------------------------------+