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

Wildcard tables

Wildcard is a way of performing a union on tables whose names are similar and have compatible schemas. The following queries show how to perform wildcard operations on tables in the public dataset bigquery-public-data:new_york provided by Google.

The following query gets the number of trips per year made by a yellow taxi in New York. The query uses UNION ALL on all tables that start with the name tlc_yellow_trips_. If a new table is added for 2017, this query has to be modified to include that table as well. To automatically include tables having similar names in the query, wildcard table syntax can be used. This query uses standard SQL:

#standardSQLSELECT MAX(EXTRACT(YEAR from pickup_datetime)) as TripYear, count(1) as TripCount ...
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