name
is a regular text column.pay_by_quarter
is a one-dimensional array of integers, representing an employee’s salary by quarter.schedule
is a two-dimensional array of text, representing an employee’s weekly schedule.ARRAY
keyword for one-dimensional arrays:
[]
) to the data type name of the array elements. The declared size or number of dimensions doesn’t affect runtime behavior; it’s mainly for documentation purposes1.
[index]
syntax. The first element has an index of one:
ARRAY[...]
constructor to create or modify arrays:
ANY
or ALL
:
array_length(arr, dim)
: Returns the length of the array along the specified dimension.unnest(arr)
: Expands an array into a set of rows.array_agg(expr)
: Aggregates values into an array.@>
and <@
: Tests if an array contains another array or value.