Skip to Content
Learning Google BigQuery
book

Learning Google BigQuery

by Thirukkumaran Haridass, Eric Brown
December 2017
Beginner to intermediate
264 pages
5h 38m
English
Packt Publishing
Content preview from Learning Google BigQuery

WITHIN

BigQuery supports the WITHIN clause, which can be used to query nested and repeated fields. The following screenshot shows how a repeated field looks; language is a repeated field with two columns, name and bytes:

The following query uses the WITHIN clause to get the count of programming languages used in each repository. This query counts the number of programming languages in each record and displays that count at the record level:

#legacySQLSELECT repo_name,COUNT(language.name) WITHIN RECORD as repo_language_countFROM [bigquery-public-data:github_repos.languages] ORDER BY repo_language_count DESC
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Google BigQuery: The Definitive Guide

Google BigQuery: The Definitive Guide

Valliappa Lakshmanan, Jordan Tigani
Google BigQuery Analytics

Google BigQuery Analytics

Siddartha Naidu, Jordan Tigani

Publisher Resources

ISBN: 9781787288591Supplemental Content