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:

#legacySQL
SELECT
repo_name,
COUNT(language.name) WITHIN RECORD as repo_language_count
FROM [bigquery-public-data:github_repos.languages]
ORDER BY repo_language_count DESC
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.83.199