A No-Fear Introduction to Working with SQL Nested & Repeated Fields

Making SQL nested and repeated data types more understandable — and less intimidating.

Share
Storks in a tree.
Storks demonstrating the nesting concept. Photo by Grégoire Bertaud on Unsplash.

Prior to beginning my current role, my now-boss sent me a brief email with some resources to help get me up to speed on our team’s tech stack.

Among that material: An article demonstrating how to work with nested and repeated SQL fields in BigQuery.

They emphasized that manipulating complex data types would be a pivotal job responsibility, as many of our tables contained nested and repeated fields.

Here’s the thing: With platforms like GCP’s BigQuery supporting nested schemas, there’s a good chance your future employer’s data warehouse also includes nested and repeated fields.

And, like me, you’ll need to be able to write queries that can access and manipulate these fields.

If you’re only a few months into your learning SQL journey you might think you’re not quite ready to learn about such complex data types.

But here’s a secret: The concepts I’m going to introduce you to all involve basic SQL operations. No windows. No cube functions. No CTEs.

Just SELECT * and a few extra steps.

However, before we access this data, you need to understand the distinction between the kinds of complex data types we can store in BigQuery.

Build Your Pipeline To A Data Engineering Career

You’ve reached the limit of the public preview. The full version of this post includes the implementation details: The code, the edge cases, and the "why" behind the architecture.

When you join PipelineToDE, you get:

  • The DA → DE Pathway Course: A structured roadmap to bridge the gap between analysis and engineering.
  • Weekly Senior Deep Dives: Fresh, tactical insights on Python, Cloud (GCP/AWS), and modern orchestration delivered every week.
  • Production-Ready Blueprints: Access to 80+ protected stories and code repos from my time in the trenches as a Senior DE
  • The DE Job Board (Coming Soon): Exclusive access to a curated board of high-agency Data Engineering roles.