Use the struct data type to create a column that contains nested columns. The nested columns can be of different data types, including the struct type.
STRUCT< >
Struct types are declared using the angle brackets (<
and >
).
x
that contains struct a
, which contains two nested columns (b
and c
) that are both integers.
y
that contains struct a
, which contains another struct c
.
()
in the SQL statement. For example, (1, true)
. Alternatively, you can also use ROW(1, true)
.
x
.
y
.
trip
.
()
and use the dot operator to specify the nested column. For example, to access the initial_charge
column under fare
in the trip
schema, use (fare).initial_charge
.