Use below

SELECT
  col_a, col_b, el
FROM
  `table`,
UNNEST(array) as el
Answer from Mikhail Berlyant on Stack Overflow
🌐
Google
docs.cloud.google.com › bigquery › work with arrays
Work with arrays | BigQuery | Google Cloud Documentation
For each row N in the source table, UNNEST flattens the ARRAY from row N into a set of rows containing the ARRAY elements, and then a correlated INNER JOIN or CROSS JOIN combines this new set of rows with the single row N from the source table.
Discussions

Unnesting an array within an array
I would opt for a normalized approach first. Unnest each array into its own dimension table, then build a view that flattens/denormalizes everything More on reddit.com
🌐 r/bigquery
6
5
October 5, 2021
google bigquery - How to flatten an array with UNNEST or any other functions? - Stack Overflow
Suppose I get a temporary table with one field is an array, how to turn it to multiple rows ? With PostgreSQL this can be done with UNNEST http://sqlfiddle.com/#!15/21673/19 WITH x AS (SELECT ARR... More on stackoverflow.com
🌐 stackoverflow.com
Resources for learning STRUCT, ARRAY, UNNEST
If you’re familiar with basic DB concepts, “STRUCT” is just the BQ-SQL term for “Record”. It’s a container with a fixed, named set of slots that you define. Conceptually, for Arrays and Structs, think of a stacked set of toolboxes, where each toolbox has the exact same layout inside. Each identical toolbox is a struct, and the entire joined stack is an array. You put things “into” individual fields of a struct using STRUCT assignments, and you get them “out” using dot notation (“stuct_name.field_name”). You stack/combine multiple structs “into” a single array using the “ARRAY_AGG()” function. You get those records back “out” using “UNNEST”, which really just transforms the array into a table, that you can then query. More on reddit.com
🌐 r/bigquery
3
3
September 6, 2024
BigQuery UNNEST and Working with Arrays
How would you go about unnesting multiple array columns in one table without duplication, after unnesting the second column? More on reddit.com
🌐 r/bigquery
6
17
June 10, 2020
🌐
Count
count.co › sql-resources › bigquery-standard-sql › unnest
UNNEST | BigQuery Standard SQL - Count.co
UNNEST function. Definition, syntax, examples and common errors using BigQuery Standard SQL. The UNNEST function takes an ARRAY and returns a table with a row for each element in the ARRAY.
🌐
Medium
medium.com › data-engineers-notes › unnesting-arrays-in-bigquery-c1b48d413ece
UNNESTING ARRAYS in BigQuery
April 15, 2024 - If we want to perform operations (say find out what was the earliest enrollment date, or count the distinct activities that the members are enrolled in), we’d need to unpack these rows by UNNESTing the ARRAY where activities are stored it.
🌐
Yuichi Otsuka
yuichiotsuka.com › home › blog › bigquery unnest and working with arrays
BigQuery UNNEST and Working with Arrays - Yuichi Otsuka
June 10, 2024 - Use the UNNEST function to flatten and build arrays in BigQuery. Includes examples with UNNEST, ARRAY_AGG, and JSON Arrays.
🌐
Learn BigQuery!
scosco.github.io › learn-bigquery › foundation › subqueries.html
Subqueries: Arrays + UNNEST() | Learn BigQuery!
That means you can run SQL on arrays! Start with this little query - UNNEST() takes our hard-coded array, turns it into rows and feeds them to the FROM.
🌐
Sheetgo
sheetgo.com › home › how to use unnest in bigquery
How to use unnest in BigQuery - Sheetgo
December 17, 2025 - The UNNEST function in BigQuery is used to flatten nested or repeated data structures into separate rows. What it does is take as input a column with a nested data type like an ARRAY, and expand the nested or repeated elements into multiple rows.
Find elsewhere
🌐
Towards Data Science
towardsdatascience.com › home › latest › bigquery unnest: how to work with nested data in bigquery
BigQuery UNNEST: How to work with nested data in BigQuery | Towards Data Science
January 24, 2025 - Again, we use the BigQuery UNNEST function to achieve this. The basic approach is to: ... Reconstruct the structure using the ARRAY and STRUCT datatypes accordingly.
🌐
DiveTeam
ken-williams.com › home › blog › how to flatten a bigquery table with unnest
How to Flatten a BigQuery Table with UNNEST - Ken Williams
May 10, 2020 - As an example, let’s say that ... operator Works UNNEST allows you to flatten the “event_params” column so that each item in the array creates a single row in the table with two new columns: “event_params.key” and ...
🌐
YouTube
youtube.com › coding is for losers
Unnesting RECORD arrays in BigQuery SQL - YouTube
Using the CROSS JOIN UNNEST() function to flatten arrays into single rows in BigQuery, using the Google Analytics sample BigQuery dataset. Learn more and gra...
Published   May 21, 2019
Views   11K
🌐
Google Cloud
cloud.google.com › bigquery › array functions
Array functions | BigQuery | Google Cloud Documentation
SELECT GENERATE_ARRAY(start, 5) AS example_array FROM UNNEST([3, 4, 5]) AS start; /*---------------+ | example_array | +---------------+ | [3, 4, 5] | | [4, 5] | | [5] | +---------------*/
🌐
Reddit
reddit.com › r/bigquery › unnesting an array within an array
r/bigquery on Reddit: Unnesting an array within an array
October 5, 2021 - All about Google BigQuery · Members ... opt for a normalized approach first. Unnest each array into its own dimension table, then build a view that flattens/denormalizes everything ·...
🌐
Datawise
datawise.dev › pay-attention-to-this-when-unnesting-in-bigquery
BigQuery UNNEST: LEFT JOIN vs Comma — Which Drops Rows?
3 weeks ago - Here's a common confusion that I encounter while working with ARRAYs in BigQuery. This can lead to wrong queries in some situations. Consider the following two snippets: FROM table, UNNEST(repeated_column) AS single_item
🌐
Firebase
firebase.blog › posts › 2017 › 03 › bigquery-tip-unnest-function
BigQuery Tip: The UNNEST Function
March 22, 2017 - The UNNEST function will take an array and break it out into each of its individual elements.
🌐
MarquinSmith
marquinsmith.com › home › data analysis › unnesting in bigquery – a guided introduction
UNNESTing in BigQuery – a guided introduction | MarquinSmith
October 5, 2023 - The UNNEST function in BigQuery is used to transform arrays or repeated fields within a table into individual rows.
🌐
Reddit
reddit.com › r/bigquery › resources for learning struct, array, unnest
r/bigquery on Reddit: Resources for learning STRUCT, ARRAY, UNNEST
September 6, 2024 -

Hi,

I just started a new internship and wanted to learn how to use STRUCT, ARRAY and UNNEST.

I have some Python knowledge and I understand that ARRAY is something like a Python list, but I just can't wrap my head around STRUCT. I don't really understand the concept and the materials I find on the internet are just not speaking to me.

Does anyone have some resources that helped you understand how to work with STRUCT, ARRAY and UNNEST?

🌐
Reddit
reddit.com › r/bigquery › bigquery unnest and working with arrays
r/bigquery on Reddit: BigQuery UNNEST and Working with Arrays
June 10, 2020 - If the two array columns are related by the order in each array, you can look at the WITH OFFSET keyword for UNNEST. More replies ... There are work arounds that let you use different data types for each column in an array, and ways to nest arrays inside arrays. By creating an array of structs you can have any data types you want for each column. And if you create an array of structs of arrays of structs you can nest them together. ... I was looking for more references to read about BigQuery and came here.