01 May 19 · DataFreak · #bigquery ·   Bookmark   ×

Working with STRUCT datatype in Google Bigquery

Bigquery supports denormalized data at scale. Denormalize your data and take advantage of nested and repeated columns

How to create a table with STRUCT datatype

To create a table with STRUCT datatype:

create table Dataset2.Emp_Adrs
Address struct<Apt int64, Street string>

How to Insert to a table that has STRUCT Datatype

To insert a row into the table that has STRUCT datatype,

INSERT INTO Dataset2.Emp_Adrs(Address)  VALUES(STRUCT(1200,"Valley view Ln"))

How to SELECT from a table that has columns with STRUCT datatype

To retrieve rows from table that has STRUCT datatype,

select Address.Street from Dataset2.Emp_Adrs;


posted on 01 May 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds