What are ARRAY and STRUCT data types in BigQuery?

Quick Overview

Asks what the ARRAY and STRUCT types are in BigQuery and how they store nested, repeated data in a single row. Tests reading nested fields, flattening arrays with UNNEST without losing rows, and knowing when a nested schema beats a separate joined table.

What are ARRAY and STRUCT data types in BigQuery?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

What are `ARRAY` and `STRUCT` data types in BigQuery? ```hint One row per order Picture storing an order together with all of its line items in a single row. Ask how you would read one field of the customer, and how you would get the line items back out as separate rows. ``` ### What a Strong Answer Covers - What each type holds and how it appears in a table schema - How to read them: dot notation, element access and `UNNEST` - How an `ARRAY` of `STRUCT` models one-to-many data and why that helps analytical queries - Restrictions and pitfalls, including NULL handling, nested arrays and rows lost when flattening ### Follow-up Questions - How would you count orders that contain at least one item with quantity above 5 without duplicating order rows? - Your `UNNEST` query returns fewer orders than the table holds. Why, and how do you fix it? - When would you keep line items in a separate table instead of a nested repeated field? - How do you filter the elements of an array and rebuild it as an array in the output?

Overview: Asks what the ARRAY and STRUCT types are in BigQuery and how they store nested, repeated data in a single row. Tests reading nested fields, flattening arrays with UNNEST without losing rows, and knowing when a nested schema beats a separate joined table.

Nov 24, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

What are ARRAY and STRUCT data types in BigQuery?

What a Strong Answer Covers Guidance

  • What each type holds and how it appears in a table schema
  • How to read them: dot notation, element access and UNNEST
  • How an ARRAY of STRUCT models one-to-many data and why that helps analytical queries
  • Restrictions and pitfalls, including NULL handling, nested arrays and rows lost when flattening

Follow-up Questions Guidance

  • How would you count orders that contain at least one item with quantity above 5 without duplicating order rows?
  • Your UNNEST query returns fewer orders than the table holds. Why, and how do you fix it?
  • When would you keep line items in a separate table instead of a nested repeated field?
  • How do you filter the elements of an array and rebuild it as an array in the output?